88 lines
2.1 KiB
Go Template
88 lines
2.1 KiB
Go Template
// WARNING: this file is generated. DO NOT EDIT
|
|
|
|
package {{.PackageName}}
|
|
|
|
{{range .SortedFlagTypes}}
|
|
// {{.TypeName}} is a flag with type {{if .ValuePointer}}*{{end}}{{.GoType}}
|
|
type {{.TypeName}} struct {
|
|
Name string
|
|
|
|
Category string
|
|
DefaultText string
|
|
FilePath string
|
|
Usage string
|
|
|
|
Required bool
|
|
Hidden bool
|
|
HasBeenSet bool
|
|
|
|
Value {{if .ValuePointer}}*{{end}}{{.GoType}}
|
|
Destination {{if .NoDestinationPointer}}{{else}}*{{end}}{{.GoType}}
|
|
|
|
Aliases []string
|
|
EnvVars []string
|
|
|
|
defaultValue {{if .ValuePointer}}*{{end}}{{.GoType}}
|
|
|
|
{{range .StructFields}}
|
|
{{.Name}} {{if .Pointer}}*{{end}}{{.Type}}
|
|
{{end}}
|
|
}
|
|
|
|
{{if .GenerateFmtStringerInterface}}
|
|
// String returns a readable representation of this value (for usage defaults)
|
|
func (f *{{.TypeName}}) String() string {
|
|
return {{$.UrfaveCLINamespace}}FlagStringer(f)
|
|
}
|
|
{{end}}{{/* /if .GenerateFmtStringerInterface */}}
|
|
|
|
{{if .GenerateFlagInterface}}
|
|
// IsSet returns whether or not the flag has been set through env or file
|
|
func (f *{{.TypeName}}) IsSet() bool {
|
|
return f.HasBeenSet
|
|
}
|
|
|
|
// Names returns the names of the flag
|
|
func (f *{{.TypeName}}) Names() []string {
|
|
return {{$.UrfaveCLINamespace}}FlagNames(f.Name, f.Aliases)
|
|
}
|
|
|
|
// IsRequired returns whether or not the flag is required
|
|
func (f *{{.TypeName}}) IsRequired() bool {
|
|
return f.Required
|
|
}
|
|
|
|
// IsVisible returns true if the flag is not hidden, otherwise false
|
|
func (f *{{.TypeName}}) IsVisible() bool {
|
|
return !f.Hidden
|
|
}
|
|
|
|
// GetCategory returns the category of the flag
|
|
func (f *{{.TypeName}}) GetCategory() string {
|
|
return f.Category
|
|
}
|
|
|
|
// GetUsage returns the usage string for the flag
|
|
func (f *{{.TypeName}}) GetUsage() string {
|
|
return f.Usage
|
|
}
|
|
|
|
// GetEnvVars returns the env vars for this flag
|
|
func (f *{{.TypeName}}) GetEnvVars() []string {
|
|
return f.EnvVars
|
|
}
|
|
|
|
// TakesValue returns true if the flag takes a value, otherwise false
|
|
func (f *{{.TypeName}}) TakesValue() bool {
|
|
return "{{.TypeName }}" != "BoolFlag"
|
|
}
|
|
|
|
{{end}}{{/* /if .GenerateFlagInterface */}}
|
|
|
|
{{end}}{{/* /range .SortedFlagTypes */}}
|
|
|
|
// vim{{/* 👻 */}}:ro
|
|
{{/*
|
|
vim:filetype=gotexttmpl
|
|
*/}}
|