mirror of https://github.com/go-gitea/gitea
Git with a cup of tea, painless self-hosted git service
Mirror for internal git.with.parts use
https://git.with.parts
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1021 B
36 lines
1021 B
9 months ago
|
// Copyright 2024 The Gitea Authors. All rights reserved.
|
||
|
// SPDX-License-Identifier: MIT
|
||
|
|
||
|
package git
|
||
|
|
||
|
import (
|
||
|
"code.gitea.io/gitea/modules/optional"
|
||
|
)
|
||
|
|
||
|
const (
|
||
|
AttributeLinguistVendored = "linguist-vendored"
|
||
|
AttributeLinguistGenerated = "linguist-generated"
|
||
|
AttributeLinguistDocumentation = "linguist-documentation"
|
||
|
AttributeLinguistDetectable = "linguist-detectable"
|
||
|
AttributeLinguistLanguage = "linguist-language"
|
||
|
AttributeGitlabLanguage = "gitlab-language"
|
||
|
)
|
||
|
|
||
|
// true if "set"/"true", false if "unset"/"false", none otherwise
|
||
|
func AttributeToBool(attr map[string]string, name string) optional.Option[bool] {
|
||
|
switch attr[name] {
|
||
|
case "set", "true":
|
||
|
return optional.Some(true)
|
||
|
case "unset", "false":
|
||
|
return optional.Some(false)
|
||
|
}
|
||
|
return optional.None[bool]()
|
||
|
}
|
||
|
|
||
|
func AttributeToString(attr map[string]string, name string) optional.Option[string] {
|
||
|
if value, has := attr[name]; has && value != "unspecified" {
|
||
|
return optional.Some(value)
|
||
|
}
|
||
|
return optional.None[string]()
|
||
|
}
|