feat: gitea client

This commit is contained in:
2026-02-12 20:58:55 +01:00
parent 8583ab48ce
commit 9bd7d363ba
1693 changed files with 653995 additions and 49 deletions

90
vendor/github.com/alecthomas/kong-yaml/.golangci.yml generated vendored Normal file
View File

@@ -0,0 +1,90 @@
run:
tests: true
skip-dirs:
- _examples
output:
print-issued-lines: false
linters:
enable-all: true
disable:
- maligned
- megacheck
- lll
- gocyclo
- dupl
- gochecknoglobals
- funlen
- godox
- wsl
- gomnd
- gocognit
- goerr113
- nolintlint
- testpackage
- godot
- nestif
- paralleltest
- nlreturn
- cyclop
- exhaustivestruct
- gci
- gofumpt
- errorlint
- exhaustive
- ifshort
- wrapcheck
- stylecheck
- thelper
- nonamedreturns
- revive
- dupword
- exhaustruct
- varnamelen
- forcetypeassert
- ireturn
- maintidx
- govet
- nosnakecase
- testableexamples
- musttag
linters-settings:
govet:
check-shadowing: true
gocyclo:
min-complexity: 10
dupl:
threshold: 100
goconst:
min-len: 8
min-occurrences: 3
forbidigo:
#forbid:
# - (Must)?NewLexer$
exclude_godoc_examples: false
issues:
max-per-linter: 0
max-same: 0
exclude-use-default: false
exclude:
# Captured by errcheck.
- '^(G104|G204):'
# Very commonly not checked.
- 'Error return value of .(.*\.Help|.*\.MarkFlagRequired|(os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked'
- 'exported method (.*\.MarshalJSON|.*\.UnmarshalJSON|.*\.EntityURN|.*\.GoString|.*\.Pos) should have comment or be unexported'
- 'composite literal uses unkeyed fields'
- 'declaration of "err" shadows declaration'
- 'should not use dot imports'
- 'Potential file inclusion via variable'
- 'should have comment or be unexported'
- 'comment on exported var .* should be of the form'
- 'at least one file in a package should have a package comment'
- 'string literal contains the Unicode'
- 'methods on the same type should have the same receiver name'
- '_TokenType_name should be _TokenTypeName'
- '`_TokenType_map` should be `_TokenTypeMap`'
- 'rewrite if-else to switch statement'

26
vendor/github.com/alecthomas/kong-yaml/README.md generated vendored Normal file
View File

@@ -0,0 +1,26 @@
# Kong YAML utilities [![](https://godoc.org/github.com/alecthomas/kong-yaml?status.svg)](http://godoc.org/github.com/alecthomas/kong-yaml) [![CircleCI](https://img.shields.io/circleci/project/github/alecthomas/kong-yaml.svg)](https://circleci.com/gh/alecthomas/kong-yaml)
## Configuration loader
Use it like so:
```go
parser, err := kong.New(&cli, kong.Configuration(kongyaml.Loader, "/etc/myapp/config.yaml", "~/.myapp.yaml"))
```
## YAMLFileMapper
YAMLFileMapper implements kong.MapperValue to decode a YAML file into
a struct field.
Use it like so:
```go
var cli struct {
Profile Profile `type:"yamlfile"`
}
func main() {
kong.Parse(&cli, kong.NamedMapper("yamlfile", kongyaml.YAMLFileMapper))
}
```

35
vendor/github.com/alecthomas/kong-yaml/mapper.go generated vendored Normal file
View File

@@ -0,0 +1,35 @@
package kongyaml
import (
"os"
"reflect"
"github.com/alecthomas/kong"
"gopkg.in/yaml.v3"
)
// YAMLFileMapper implements kong.MapperValue to decode a YAML file into
// a struct field.
//
// var cli struct {
// Profile Profile `type:"yamlfile"`
// }
//
// func main() {
// kong.Parse(&cli, kong.NamedMapper("yamlfile", YAMLFileMapper))
// }
var YAMLFileMapper = kong.MapperFunc(decodeYAMLFile) //nolint: gochecknoglobals
func decodeYAMLFile(ctx *kong.DecodeContext, target reflect.Value) error {
var fname string
if err := ctx.Scan.PopValueInto("filename", &fname); err != nil {
return err
}
f, err := os.Open(fname) //nolint:gosec
if err != nil {
return err
}
defer f.Close() //nolint
return yaml.NewDecoder(f).Decode(target.Addr().Interface())
}

44
vendor/github.com/alecthomas/kong-yaml/yaml.go generated vendored Normal file
View File

@@ -0,0 +1,44 @@
package kongyaml
import (
"errors"
"fmt"
"io"
"strings"
"github.com/alecthomas/kong"
"gopkg.in/yaml.v3"
)
// Loader is a Kong configuration loader for YAML.
func Loader(r io.Reader) (kong.Resolver, error) {
decoder := yaml.NewDecoder(r)
config := map[string]interface{}{}
err := decoder.Decode(config)
if err != nil && !errors.Is(err, io.EOF) {
return nil, fmt.Errorf("YAML config decode error: %w", err)
}
return kong.ResolverFunc(func(context *kong.Context, parent *kong.Path, flag *kong.Flag) (interface{}, error) {
// Build a string path up to this flag.
path := []string{}
for n := parent.Node(); n != nil && n.Type != kong.ApplicationNode; n = n.Parent {
path = append([]string{n.Name}, path...)
}
path = append(path, flag.Name)
path = strings.Split(strings.Join(path, "-"), "-")
return find(config, path), nil
}), nil
}
func find(config map[string]interface{}, path []string) interface{} {
if len(path) == 0 {
return config
}
for i := 0; i < len(path); i++ {
prefix := strings.Join(path[:i+1], "-")
if child, ok := config[prefix].(map[string]interface{}); ok {
return find(child, path[i+1:])
}
}
return config[strings.Join(path, "-")]
}