forked from forgejo/forgejo
Use vendored go-swagger (#8087)
* Use vendored go-swagger * vendor go-swagger * revert un wanteed change * remove un-needed GO111MODULE * Update Makefile Co-Authored-By: techknowlogick <matti@mdranta.net>
This commit is contained in:
parent
4cb1bdddc8
commit
9fe4437bda
686 changed files with 143379 additions and 17 deletions
57
vendor/github.com/spf13/viper/flags.go
generated
vendored
Normal file
57
vendor/github.com/spf13/viper/flags.go
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
package viper
|
||||
|
||||
import "github.com/spf13/pflag"
|
||||
|
||||
// FlagValueSet is an interface that users can implement
|
||||
// to bind a set of flags to viper.
|
||||
type FlagValueSet interface {
|
||||
VisitAll(fn func(FlagValue))
|
||||
}
|
||||
|
||||
// FlagValue is an interface that users can implement
|
||||
// to bind different flags to viper.
|
||||
type FlagValue interface {
|
||||
HasChanged() bool
|
||||
Name() string
|
||||
ValueString() string
|
||||
ValueType() string
|
||||
}
|
||||
|
||||
// pflagValueSet is a wrapper around *pflag.ValueSet
|
||||
// that implements FlagValueSet.
|
||||
type pflagValueSet struct {
|
||||
flags *pflag.FlagSet
|
||||
}
|
||||
|
||||
// VisitAll iterates over all *pflag.Flag inside the *pflag.FlagSet.
|
||||
func (p pflagValueSet) VisitAll(fn func(flag FlagValue)) {
|
||||
p.flags.VisitAll(func(flag *pflag.Flag) {
|
||||
fn(pflagValue{flag})
|
||||
})
|
||||
}
|
||||
|
||||
// pflagValue is a wrapper aroung *pflag.flag
|
||||
// that implements FlagValue
|
||||
type pflagValue struct {
|
||||
flag *pflag.Flag
|
||||
}
|
||||
|
||||
// HasChanges returns whether the flag has changes or not.
|
||||
func (p pflagValue) HasChanged() bool {
|
||||
return p.flag.Changed
|
||||
}
|
||||
|
||||
// Name returns the name of the flag.
|
||||
func (p pflagValue) Name() string {
|
||||
return p.flag.Name
|
||||
}
|
||||
|
||||
// ValueString returns the value of the flag as a string.
|
||||
func (p pflagValue) ValueString() string {
|
||||
return p.flag.Value.String()
|
||||
}
|
||||
|
||||
// ValueType returns the type of the flag as a string.
|
||||
func (p pflagValue) ValueType() string {
|
||||
return p.flag.Value.Type()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue