Adapt flag generation for flag categories
This commit is contained in:
parent
ae97940956
commit
21d435d4d1
@ -45,11 +45,16 @@ AUTHOR{{with $length := len .Authors}}{{if ne 1 $length}}S{{end}}{{end}}:
|
|||||||
COMMANDS:{{range .VisibleCategories}}{{if .Name}}
|
COMMANDS:{{range .VisibleCategories}}{{if .Name}}
|
||||||
{{.Name}}:{{range .VisibleCommands}}
|
{{.Name}}:{{range .VisibleCommands}}
|
||||||
{{join .Names ", "}}{{"\t"}}{{.Usage}}{{end}}{{else}}{{range .VisibleCommands}}
|
{{join .Names ", "}}{{"\t"}}{{.Usage}}{{end}}{{else}}{{range .VisibleCommands}}
|
||||||
{{join .Names ", "}}{{"\t"}}{{.Usage}}{{end}}{{end}}{{end}}{{end}}{{if .VisibleFlags}}
|
{{join .Names ", "}}{{"\t"}}{{.Usage}}{{end}}{{end}}{{end}}{{end}}{{if .VisibleFlagCategories}}
|
||||||
|
|
||||||
|
GLOBAL OPTIONS:{{range .VisibleFlagCategories}}
|
||||||
|
{{if .Name}}{{.Name}}
|
||||||
|
{{end}}{{range .Flags}}{{.}}
|
||||||
|
{{end}}{{end}}{{else}}{{if .VisibleFlags}}
|
||||||
|
|
||||||
GLOBAL OPTIONS:
|
GLOBAL OPTIONS:
|
||||||
{{range $index, $option := .VisibleFlags}}{{if $index}}
|
{{range $index, $option := .VisibleFlags}}{{if $index}}
|
||||||
{{end}}{{$option}}{{end}}{{end}}{{if .Copyright}}
|
{{end}}{{$option}}{{end}}{{end}}{{end}}{{if .Copyright}}
|
||||||
|
|
||||||
COPYRIGHT:
|
COPYRIGHT:
|
||||||
{{.Copyright}}{{end}}
|
{{.Copyright}}{{end}}
|
||||||
@ -68,11 +73,16 @@ CATEGORY:
|
|||||||
{{.Category}}{{end}}{{if .Description}}
|
{{.Category}}{{end}}{{if .Description}}
|
||||||
|
|
||||||
DESCRIPTION:
|
DESCRIPTION:
|
||||||
{{.Description | nindent 3 | trim}}{{end}}{{if .VisibleFlags}}
|
{{.Description | nindent 3 | trim}}{{end}}{{if .VisibleFlagCategories}}
|
||||||
|
|
||||||
|
OPTIONS:{{range .VisibleFlagCategories}}
|
||||||
|
{{if .Name}}{{.Name}}
|
||||||
|
{{end}}{{range .Flags}}{{.}}
|
||||||
|
{{end}}{{end}}{{else}}{{if .VisibleFlags}}
|
||||||
|
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
{{range .VisibleFlags}}{{.}}
|
{{range .VisibleFlags}}{{.}}
|
||||||
{{end}}{{end}}
|
{{end}}{{end}}{{end}}
|
||||||
`
|
`
|
||||||
CommandHelpTemplate is the text template for the command help topic. cli.go
|
CommandHelpTemplate is the text template for the command help topic. cli.go
|
||||||
uses text/template to render templates. You can render custom help text by
|
uses text/template to render templates. You can render custom help text by
|
||||||
@ -367,6 +377,10 @@ func (a *App) VisibleCategories() []CommandCategory
|
|||||||
func (a *App) VisibleCommands() []*Command
|
func (a *App) VisibleCommands() []*Command
|
||||||
VisibleCommands returns a slice of the Commands with Hidden=false
|
VisibleCommands returns a slice of the Commands with Hidden=false
|
||||||
|
|
||||||
|
func (a *App) VisibleFlagCategories() []VisibleFlagCategory
|
||||||
|
VisibleFlagCategories returns a slice containing all the categories with the
|
||||||
|
flags they contain
|
||||||
|
|
||||||
func (a *App) VisibleFlags() []Flag
|
func (a *App) VisibleFlags() []Flag
|
||||||
VisibleFlags returns a slice of the Flags with Hidden=false
|
VisibleFlags returns a slice of the Flags with Hidden=false
|
||||||
|
|
||||||
@ -407,6 +421,7 @@ type BeforeFunc func(*Context) error
|
|||||||
type BoolFlag struct {
|
type BoolFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -429,6 +444,9 @@ func (f *BoolFlag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *BoolFlag) Get(ctx *Context) bool
|
func (f *BoolFlag) Get(ctx *Context) bool
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *BoolFlag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *BoolFlag) GetDefaultText() string
|
func (f *BoolFlag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
@ -460,6 +478,14 @@ func (f *BoolFlag) String() string
|
|||||||
func (f *BoolFlag) TakesValue() bool
|
func (f *BoolFlag) TakesValue() bool
|
||||||
TakesValue returns true of the flag takes a value, otherwise false
|
TakesValue returns true of the flag takes a value, otherwise false
|
||||||
|
|
||||||
|
type CategorizableFlag interface {
|
||||||
|
VisibleFlag
|
||||||
|
|
||||||
|
GetCategory() string
|
||||||
|
}
|
||||||
|
CategorizableFlag is an interface that allows us to potentially use a flag
|
||||||
|
in a categorized representation.
|
||||||
|
|
||||||
type Command struct {
|
type Command struct {
|
||||||
// The name of the command
|
// The name of the command
|
||||||
Name string
|
Name string
|
||||||
@ -491,6 +517,7 @@ type Command struct {
|
|||||||
Subcommands []*Command
|
Subcommands []*Command
|
||||||
// List of flags to parse
|
// List of flags to parse
|
||||||
Flags []Flag
|
Flags []Flag
|
||||||
|
|
||||||
// Treat all flags as normal arguments if true
|
// Treat all flags as normal arguments if true
|
||||||
SkipFlagParsing bool
|
SkipFlagParsing bool
|
||||||
// Boolean to hide built-in help command and help flag
|
// Boolean to hide built-in help command and help flag
|
||||||
@ -530,13 +557,17 @@ func (c *Command) Run(ctx *Context) (err error)
|
|||||||
Run invokes the command given the context, parses ctx.Args() to generate
|
Run invokes the command given the context, parses ctx.Args() to generate
|
||||||
command-specific flags
|
command-specific flags
|
||||||
|
|
||||||
|
func (c *Command) VisibleFlagCategories() []VisibleFlagCategory
|
||||||
|
VisibleFlagCategories returns a slice containing all the visible flag
|
||||||
|
categories with the flags they contain
|
||||||
|
|
||||||
func (c *Command) VisibleFlags() []Flag
|
func (c *Command) VisibleFlags() []Flag
|
||||||
VisibleFlags returns a slice of the Flags with Hidden=false
|
VisibleFlags returns a slice of the Flags with Hidden=false
|
||||||
|
|
||||||
type CommandCategories interface {
|
type CommandCategories interface {
|
||||||
// AddCommand adds a command to a category, creating a new category if necessary.
|
// AddCommand adds a command to a category, creating a new category if necessary.
|
||||||
AddCommand(category string, command *Command)
|
AddCommand(category string, command *Command)
|
||||||
// categories returns a copy of the category slice
|
// Categories returns a slice of categories sorted by name
|
||||||
Categories() []CommandCategory
|
Categories() []CommandCategory
|
||||||
}
|
}
|
||||||
CommandCategories interface allows for category manipulation
|
CommandCategories interface allows for category manipulation
|
||||||
@ -680,6 +711,7 @@ type DocGenerationFlag interface {
|
|||||||
type DurationFlag struct {
|
type DurationFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -702,6 +734,9 @@ func (f *DurationFlag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *DurationFlag) Get(ctx *Context) time.Duration
|
func (f *DurationFlag) Get(ctx *Context) time.Duration
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *DurationFlag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *DurationFlag) GetDefaultText() string
|
func (f *DurationFlag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
@ -797,6 +832,14 @@ var VersionFlag Flag = &BoolFlag{
|
|||||||
}
|
}
|
||||||
VersionFlag prints the version for the application
|
VersionFlag prints the version for the application
|
||||||
|
|
||||||
|
type FlagCategories interface {
|
||||||
|
// AddFlags adds a flag to a category, creating a new category if necessary.
|
||||||
|
AddFlag(category string, fl Flag)
|
||||||
|
// VisibleCategories returns a slice of visible flag categories sorted by name
|
||||||
|
VisibleCategories() []VisibleFlagCategory
|
||||||
|
}
|
||||||
|
FlagCategories interface allows for category manipulation
|
||||||
|
|
||||||
type FlagEnvHintFunc func(envVars []string, str string) string
|
type FlagEnvHintFunc func(envVars []string, str string) string
|
||||||
FlagEnvHintFunc is used by the default FlagStringFunc to annotate flag help
|
FlagEnvHintFunc is used by the default FlagStringFunc to annotate flag help
|
||||||
with the environment variable details.
|
with the environment variable details.
|
||||||
@ -841,6 +884,7 @@ func (f FlagsByName) Swap(i, j int)
|
|||||||
type Float64Flag struct {
|
type Float64Flag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -863,6 +907,9 @@ func (f *Float64Flag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *Float64Flag) Get(ctx *Context) float64
|
func (f *Float64Flag) Get(ctx *Context) float64
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *Float64Flag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *Float64Flag) GetDefaultText() string
|
func (f *Float64Flag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
@ -920,6 +967,7 @@ func (f *Float64Slice) Value() []float64
|
|||||||
type Float64SliceFlag struct {
|
type Float64SliceFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -942,6 +990,9 @@ func (f *Float64SliceFlag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *Float64SliceFlag) Get(ctx *Context) []float64
|
func (f *Float64SliceFlag) Get(ctx *Context) []float64
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *Float64SliceFlag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *Float64SliceFlag) GetDefaultText() string
|
func (f *Float64SliceFlag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
@ -982,6 +1033,7 @@ type Generic interface {
|
|||||||
type GenericFlag struct {
|
type GenericFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -1007,6 +1059,9 @@ func (f GenericFlag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *GenericFlag) Get(ctx *Context) interface{}
|
func (f *GenericFlag) Get(ctx *Context) interface{}
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *GenericFlag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *GenericFlag) GetDefaultText() string
|
func (f *GenericFlag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
@ -1041,6 +1096,7 @@ func (f *GenericFlag) TakesValue() bool
|
|||||||
type Int64Flag struct {
|
type Int64Flag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -1063,6 +1119,9 @@ func (f *Int64Flag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *Int64Flag) Get(ctx *Context) int64
|
func (f *Int64Flag) Get(ctx *Context) int64
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *Int64Flag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *Int64Flag) GetDefaultText() string
|
func (f *Int64Flag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
@ -1120,6 +1179,7 @@ func (i *Int64Slice) Value() []int64
|
|||||||
type Int64SliceFlag struct {
|
type Int64SliceFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -1142,13 +1202,16 @@ func (f *Int64SliceFlag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *Int64SliceFlag) Get(ctx *Context) []int64
|
func (f *Int64SliceFlag) Get(ctx *Context) []int64
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *Int64SliceFlag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *Int64SliceFlag) GetDefaultText() string
|
func (f *Int64SliceFlag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
func (f *Int64SliceFlag) GetEnvVars() []string
|
func (f *Int64SliceFlag) GetEnvVars() []string
|
||||||
GetEnvVars returns the env vars for this flag
|
GetEnvVars returns the env vars for this flag
|
||||||
|
|
||||||
func (f Int64SliceFlag) GetUsage() string
|
func (f *Int64SliceFlag) GetUsage() string
|
||||||
GetUsage returns the usage string for the flag
|
GetUsage returns the usage string for the flag
|
||||||
|
|
||||||
func (f *Int64SliceFlag) GetValue() string
|
func (f *Int64SliceFlag) GetValue() string
|
||||||
@ -1176,6 +1239,7 @@ func (f *Int64SliceFlag) TakesValue() bool
|
|||||||
type IntFlag struct {
|
type IntFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -1198,6 +1262,9 @@ func (f *IntFlag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *IntFlag) Get(ctx *Context) int
|
func (f *IntFlag) Get(ctx *Context) int
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *IntFlag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *IntFlag) GetDefaultText() string
|
func (f *IntFlag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
@ -1259,6 +1326,7 @@ func (i *IntSlice) Value() []int
|
|||||||
type IntSliceFlag struct {
|
type IntSliceFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -1281,13 +1349,16 @@ func (f *IntSliceFlag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *IntSliceFlag) Get(ctx *Context) []int
|
func (f *IntSliceFlag) Get(ctx *Context) []int
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *IntSliceFlag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *IntSliceFlag) GetDefaultText() string
|
func (f *IntSliceFlag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
func (f *IntSliceFlag) GetEnvVars() []string
|
func (f *IntSliceFlag) GetEnvVars() []string
|
||||||
GetEnvVars returns the env vars for this flag
|
GetEnvVars returns the env vars for this flag
|
||||||
|
|
||||||
func (f IntSliceFlag) GetUsage() string
|
func (f *IntSliceFlag) GetUsage() string
|
||||||
GetUsage returns the usage string for the flag
|
GetUsage returns the usage string for the flag
|
||||||
|
|
||||||
func (f *IntSliceFlag) GetValue() string
|
func (f *IntSliceFlag) GetValue() string
|
||||||
@ -1329,6 +1400,7 @@ type Path = string
|
|||||||
type PathFlag struct {
|
type PathFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -1353,6 +1425,9 @@ func (f *PathFlag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *PathFlag) Get(ctx *Context) string
|
func (f *PathFlag) Get(ctx *Context) string
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *PathFlag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *PathFlag) GetDefaultText() string
|
func (f *PathFlag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
@ -1401,6 +1476,7 @@ type Serializer interface {
|
|||||||
type StringFlag struct {
|
type StringFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -1425,6 +1501,9 @@ func (f *StringFlag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *StringFlag) Get(ctx *Context) string
|
func (f *StringFlag) Get(ctx *Context) string
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *StringFlag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *StringFlag) GetDefaultText() string
|
func (f *StringFlag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
@ -1482,6 +1561,7 @@ func (s *StringSlice) Value() []string
|
|||||||
type StringSliceFlag struct {
|
type StringSliceFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -1506,6 +1586,9 @@ func (f *StringSliceFlag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *StringSliceFlag) Get(ctx *Context) []string
|
func (f *StringSliceFlag) Get(ctx *Context) []string
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *StringSliceFlag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *StringSliceFlag) GetDefaultText() string
|
func (f *StringSliceFlag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
@ -1566,6 +1649,7 @@ func (t *Timestamp) Value() *time.Time
|
|||||||
type TimestampFlag struct {
|
type TimestampFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -1590,6 +1674,9 @@ func (f *TimestampFlag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *TimestampFlag) Get(ctx *Context) *time.Time
|
func (f *TimestampFlag) Get(ctx *Context) *time.Time
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *TimestampFlag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *TimestampFlag) GetDefaultText() string
|
func (f *TimestampFlag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
@ -1624,6 +1711,7 @@ func (f *TimestampFlag) TakesValue() bool
|
|||||||
type Uint64Flag struct {
|
type Uint64Flag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -1646,6 +1734,9 @@ func (f *Uint64Flag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *Uint64Flag) Get(ctx *Context) uint64
|
func (f *Uint64Flag) Get(ctx *Context) uint64
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *Uint64Flag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *Uint64Flag) GetDefaultText() string
|
func (f *Uint64Flag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
@ -1680,6 +1771,7 @@ func (f *Uint64Flag) TakesValue() bool
|
|||||||
type UintFlag struct {
|
type UintFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -1702,6 +1794,9 @@ func (f *UintFlag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *UintFlag) Get(ctx *Context) uint
|
func (f *UintFlag) Get(ctx *Context) uint
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *UintFlag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *UintFlag) GetDefaultText() string
|
func (f *UintFlag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
@ -1741,6 +1836,14 @@ type VisibleFlag interface {
|
|||||||
}
|
}
|
||||||
VisibleFlag is an interface that allows to check if a flag is visible
|
VisibleFlag is an interface that allows to check if a flag is visible
|
||||||
|
|
||||||
|
type VisibleFlagCategory interface {
|
||||||
|
// Name returns the category name string
|
||||||
|
Name() string
|
||||||
|
// Flags returns a slice of VisibleFlag sorted by name
|
||||||
|
Flags() []VisibleFlag
|
||||||
|
}
|
||||||
|
VisibleFlagCategory is a category containing flags.
|
||||||
|
|
||||||
package altsrc // import "github.com/urfave/cli/v2/altsrc"
|
package altsrc // import "github.com/urfave/cli/v2/altsrc"
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ package {{.PackageName}}
|
|||||||
type {{.TypeName}} struct {
|
type {{.TypeName}} struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
|
117
testdata/godoc-v2.x.txt
vendored
117
testdata/godoc-v2.x.txt
vendored
@ -45,11 +45,16 @@ AUTHOR{{with $length := len .Authors}}{{if ne 1 $length}}S{{end}}{{end}}:
|
|||||||
COMMANDS:{{range .VisibleCategories}}{{if .Name}}
|
COMMANDS:{{range .VisibleCategories}}{{if .Name}}
|
||||||
{{.Name}}:{{range .VisibleCommands}}
|
{{.Name}}:{{range .VisibleCommands}}
|
||||||
{{join .Names ", "}}{{"\t"}}{{.Usage}}{{end}}{{else}}{{range .VisibleCommands}}
|
{{join .Names ", "}}{{"\t"}}{{.Usage}}{{end}}{{else}}{{range .VisibleCommands}}
|
||||||
{{join .Names ", "}}{{"\t"}}{{.Usage}}{{end}}{{end}}{{end}}{{end}}{{if .VisibleFlags}}
|
{{join .Names ", "}}{{"\t"}}{{.Usage}}{{end}}{{end}}{{end}}{{end}}{{if .VisibleFlagCategories}}
|
||||||
|
|
||||||
|
GLOBAL OPTIONS:{{range .VisibleFlagCategories}}
|
||||||
|
{{if .Name}}{{.Name}}
|
||||||
|
{{end}}{{range .Flags}}{{.}}
|
||||||
|
{{end}}{{end}}{{else}}{{if .VisibleFlags}}
|
||||||
|
|
||||||
GLOBAL OPTIONS:
|
GLOBAL OPTIONS:
|
||||||
{{range $index, $option := .VisibleFlags}}{{if $index}}
|
{{range $index, $option := .VisibleFlags}}{{if $index}}
|
||||||
{{end}}{{$option}}{{end}}{{end}}{{if .Copyright}}
|
{{end}}{{$option}}{{end}}{{end}}{{end}}{{if .Copyright}}
|
||||||
|
|
||||||
COPYRIGHT:
|
COPYRIGHT:
|
||||||
{{.Copyright}}{{end}}
|
{{.Copyright}}{{end}}
|
||||||
@ -68,11 +73,16 @@ CATEGORY:
|
|||||||
{{.Category}}{{end}}{{if .Description}}
|
{{.Category}}{{end}}{{if .Description}}
|
||||||
|
|
||||||
DESCRIPTION:
|
DESCRIPTION:
|
||||||
{{.Description | nindent 3 | trim}}{{end}}{{if .VisibleFlags}}
|
{{.Description | nindent 3 | trim}}{{end}}{{if .VisibleFlagCategories}}
|
||||||
|
|
||||||
|
OPTIONS:{{range .VisibleFlagCategories}}
|
||||||
|
{{if .Name}}{{.Name}}
|
||||||
|
{{end}}{{range .Flags}}{{.}}
|
||||||
|
{{end}}{{end}}{{else}}{{if .VisibleFlags}}
|
||||||
|
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
{{range .VisibleFlags}}{{.}}
|
{{range .VisibleFlags}}{{.}}
|
||||||
{{end}}{{end}}
|
{{end}}{{end}}{{end}}
|
||||||
`
|
`
|
||||||
CommandHelpTemplate is the text template for the command help topic. cli.go
|
CommandHelpTemplate is the text template for the command help topic. cli.go
|
||||||
uses text/template to render templates. You can render custom help text by
|
uses text/template to render templates. You can render custom help text by
|
||||||
@ -367,6 +377,10 @@ func (a *App) VisibleCategories() []CommandCategory
|
|||||||
func (a *App) VisibleCommands() []*Command
|
func (a *App) VisibleCommands() []*Command
|
||||||
VisibleCommands returns a slice of the Commands with Hidden=false
|
VisibleCommands returns a slice of the Commands with Hidden=false
|
||||||
|
|
||||||
|
func (a *App) VisibleFlagCategories() []VisibleFlagCategory
|
||||||
|
VisibleFlagCategories returns a slice containing all the categories with the
|
||||||
|
flags they contain
|
||||||
|
|
||||||
func (a *App) VisibleFlags() []Flag
|
func (a *App) VisibleFlags() []Flag
|
||||||
VisibleFlags returns a slice of the Flags with Hidden=false
|
VisibleFlags returns a slice of the Flags with Hidden=false
|
||||||
|
|
||||||
@ -407,6 +421,7 @@ type BeforeFunc func(*Context) error
|
|||||||
type BoolFlag struct {
|
type BoolFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -429,6 +444,9 @@ func (f *BoolFlag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *BoolFlag) Get(ctx *Context) bool
|
func (f *BoolFlag) Get(ctx *Context) bool
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *BoolFlag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *BoolFlag) GetDefaultText() string
|
func (f *BoolFlag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
@ -460,6 +478,14 @@ func (f *BoolFlag) String() string
|
|||||||
func (f *BoolFlag) TakesValue() bool
|
func (f *BoolFlag) TakesValue() bool
|
||||||
TakesValue returns true of the flag takes a value, otherwise false
|
TakesValue returns true of the flag takes a value, otherwise false
|
||||||
|
|
||||||
|
type CategorizableFlag interface {
|
||||||
|
VisibleFlag
|
||||||
|
|
||||||
|
GetCategory() string
|
||||||
|
}
|
||||||
|
CategorizableFlag is an interface that allows us to potentially use a flag
|
||||||
|
in a categorized representation.
|
||||||
|
|
||||||
type Command struct {
|
type Command struct {
|
||||||
// The name of the command
|
// The name of the command
|
||||||
Name string
|
Name string
|
||||||
@ -491,6 +517,7 @@ type Command struct {
|
|||||||
Subcommands []*Command
|
Subcommands []*Command
|
||||||
// List of flags to parse
|
// List of flags to parse
|
||||||
Flags []Flag
|
Flags []Flag
|
||||||
|
|
||||||
// Treat all flags as normal arguments if true
|
// Treat all flags as normal arguments if true
|
||||||
SkipFlagParsing bool
|
SkipFlagParsing bool
|
||||||
// Boolean to hide built-in help command and help flag
|
// Boolean to hide built-in help command and help flag
|
||||||
@ -530,13 +557,17 @@ func (c *Command) Run(ctx *Context) (err error)
|
|||||||
Run invokes the command given the context, parses ctx.Args() to generate
|
Run invokes the command given the context, parses ctx.Args() to generate
|
||||||
command-specific flags
|
command-specific flags
|
||||||
|
|
||||||
|
func (c *Command) VisibleFlagCategories() []VisibleFlagCategory
|
||||||
|
VisibleFlagCategories returns a slice containing all the visible flag
|
||||||
|
categories with the flags they contain
|
||||||
|
|
||||||
func (c *Command) VisibleFlags() []Flag
|
func (c *Command) VisibleFlags() []Flag
|
||||||
VisibleFlags returns a slice of the Flags with Hidden=false
|
VisibleFlags returns a slice of the Flags with Hidden=false
|
||||||
|
|
||||||
type CommandCategories interface {
|
type CommandCategories interface {
|
||||||
// AddCommand adds a command to a category, creating a new category if necessary.
|
// AddCommand adds a command to a category, creating a new category if necessary.
|
||||||
AddCommand(category string, command *Command)
|
AddCommand(category string, command *Command)
|
||||||
// categories returns a copy of the category slice
|
// Categories returns a slice of categories sorted by name
|
||||||
Categories() []CommandCategory
|
Categories() []CommandCategory
|
||||||
}
|
}
|
||||||
CommandCategories interface allows for category manipulation
|
CommandCategories interface allows for category manipulation
|
||||||
@ -680,6 +711,7 @@ type DocGenerationFlag interface {
|
|||||||
type DurationFlag struct {
|
type DurationFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -702,6 +734,9 @@ func (f *DurationFlag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *DurationFlag) Get(ctx *Context) time.Duration
|
func (f *DurationFlag) Get(ctx *Context) time.Duration
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *DurationFlag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *DurationFlag) GetDefaultText() string
|
func (f *DurationFlag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
@ -797,6 +832,14 @@ var VersionFlag Flag = &BoolFlag{
|
|||||||
}
|
}
|
||||||
VersionFlag prints the version for the application
|
VersionFlag prints the version for the application
|
||||||
|
|
||||||
|
type FlagCategories interface {
|
||||||
|
// AddFlags adds a flag to a category, creating a new category if necessary.
|
||||||
|
AddFlag(category string, fl Flag)
|
||||||
|
// VisibleCategories returns a slice of visible flag categories sorted by name
|
||||||
|
VisibleCategories() []VisibleFlagCategory
|
||||||
|
}
|
||||||
|
FlagCategories interface allows for category manipulation
|
||||||
|
|
||||||
type FlagEnvHintFunc func(envVars []string, str string) string
|
type FlagEnvHintFunc func(envVars []string, str string) string
|
||||||
FlagEnvHintFunc is used by the default FlagStringFunc to annotate flag help
|
FlagEnvHintFunc is used by the default FlagStringFunc to annotate flag help
|
||||||
with the environment variable details.
|
with the environment variable details.
|
||||||
@ -841,6 +884,7 @@ func (f FlagsByName) Swap(i, j int)
|
|||||||
type Float64Flag struct {
|
type Float64Flag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -863,6 +907,9 @@ func (f *Float64Flag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *Float64Flag) Get(ctx *Context) float64
|
func (f *Float64Flag) Get(ctx *Context) float64
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *Float64Flag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *Float64Flag) GetDefaultText() string
|
func (f *Float64Flag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
@ -920,6 +967,7 @@ func (f *Float64Slice) Value() []float64
|
|||||||
type Float64SliceFlag struct {
|
type Float64SliceFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -942,6 +990,9 @@ func (f *Float64SliceFlag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *Float64SliceFlag) Get(ctx *Context) []float64
|
func (f *Float64SliceFlag) Get(ctx *Context) []float64
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *Float64SliceFlag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *Float64SliceFlag) GetDefaultText() string
|
func (f *Float64SliceFlag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
@ -982,6 +1033,7 @@ type Generic interface {
|
|||||||
type GenericFlag struct {
|
type GenericFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -1007,6 +1059,9 @@ func (f GenericFlag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *GenericFlag) Get(ctx *Context) interface{}
|
func (f *GenericFlag) Get(ctx *Context) interface{}
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *GenericFlag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *GenericFlag) GetDefaultText() string
|
func (f *GenericFlag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
@ -1041,6 +1096,7 @@ func (f *GenericFlag) TakesValue() bool
|
|||||||
type Int64Flag struct {
|
type Int64Flag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -1063,6 +1119,9 @@ func (f *Int64Flag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *Int64Flag) Get(ctx *Context) int64
|
func (f *Int64Flag) Get(ctx *Context) int64
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *Int64Flag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *Int64Flag) GetDefaultText() string
|
func (f *Int64Flag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
@ -1120,6 +1179,7 @@ func (i *Int64Slice) Value() []int64
|
|||||||
type Int64SliceFlag struct {
|
type Int64SliceFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -1142,13 +1202,16 @@ func (f *Int64SliceFlag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *Int64SliceFlag) Get(ctx *Context) []int64
|
func (f *Int64SliceFlag) Get(ctx *Context) []int64
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *Int64SliceFlag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *Int64SliceFlag) GetDefaultText() string
|
func (f *Int64SliceFlag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
func (f *Int64SliceFlag) GetEnvVars() []string
|
func (f *Int64SliceFlag) GetEnvVars() []string
|
||||||
GetEnvVars returns the env vars for this flag
|
GetEnvVars returns the env vars for this flag
|
||||||
|
|
||||||
func (f Int64SliceFlag) GetUsage() string
|
func (f *Int64SliceFlag) GetUsage() string
|
||||||
GetUsage returns the usage string for the flag
|
GetUsage returns the usage string for the flag
|
||||||
|
|
||||||
func (f *Int64SliceFlag) GetValue() string
|
func (f *Int64SliceFlag) GetValue() string
|
||||||
@ -1176,6 +1239,7 @@ func (f *Int64SliceFlag) TakesValue() bool
|
|||||||
type IntFlag struct {
|
type IntFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -1198,6 +1262,9 @@ func (f *IntFlag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *IntFlag) Get(ctx *Context) int
|
func (f *IntFlag) Get(ctx *Context) int
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *IntFlag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *IntFlag) GetDefaultText() string
|
func (f *IntFlag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
@ -1259,6 +1326,7 @@ func (i *IntSlice) Value() []int
|
|||||||
type IntSliceFlag struct {
|
type IntSliceFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -1281,13 +1349,16 @@ func (f *IntSliceFlag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *IntSliceFlag) Get(ctx *Context) []int
|
func (f *IntSliceFlag) Get(ctx *Context) []int
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *IntSliceFlag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *IntSliceFlag) GetDefaultText() string
|
func (f *IntSliceFlag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
func (f *IntSliceFlag) GetEnvVars() []string
|
func (f *IntSliceFlag) GetEnvVars() []string
|
||||||
GetEnvVars returns the env vars for this flag
|
GetEnvVars returns the env vars for this flag
|
||||||
|
|
||||||
func (f IntSliceFlag) GetUsage() string
|
func (f *IntSliceFlag) GetUsage() string
|
||||||
GetUsage returns the usage string for the flag
|
GetUsage returns the usage string for the flag
|
||||||
|
|
||||||
func (f *IntSliceFlag) GetValue() string
|
func (f *IntSliceFlag) GetValue() string
|
||||||
@ -1329,6 +1400,7 @@ type Path = string
|
|||||||
type PathFlag struct {
|
type PathFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -1353,6 +1425,9 @@ func (f *PathFlag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *PathFlag) Get(ctx *Context) string
|
func (f *PathFlag) Get(ctx *Context) string
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *PathFlag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *PathFlag) GetDefaultText() string
|
func (f *PathFlag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
@ -1401,6 +1476,7 @@ type Serializer interface {
|
|||||||
type StringFlag struct {
|
type StringFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -1425,6 +1501,9 @@ func (f *StringFlag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *StringFlag) Get(ctx *Context) string
|
func (f *StringFlag) Get(ctx *Context) string
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *StringFlag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *StringFlag) GetDefaultText() string
|
func (f *StringFlag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
@ -1482,6 +1561,7 @@ func (s *StringSlice) Value() []string
|
|||||||
type StringSliceFlag struct {
|
type StringSliceFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -1506,6 +1586,9 @@ func (f *StringSliceFlag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *StringSliceFlag) Get(ctx *Context) []string
|
func (f *StringSliceFlag) Get(ctx *Context) []string
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *StringSliceFlag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *StringSliceFlag) GetDefaultText() string
|
func (f *StringSliceFlag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
@ -1566,6 +1649,7 @@ func (t *Timestamp) Value() *time.Time
|
|||||||
type TimestampFlag struct {
|
type TimestampFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -1590,6 +1674,9 @@ func (f *TimestampFlag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *TimestampFlag) Get(ctx *Context) *time.Time
|
func (f *TimestampFlag) Get(ctx *Context) *time.Time
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *TimestampFlag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *TimestampFlag) GetDefaultText() string
|
func (f *TimestampFlag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
@ -1624,6 +1711,7 @@ func (f *TimestampFlag) TakesValue() bool
|
|||||||
type Uint64Flag struct {
|
type Uint64Flag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -1646,6 +1734,9 @@ func (f *Uint64Flag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *Uint64Flag) Get(ctx *Context) uint64
|
func (f *Uint64Flag) Get(ctx *Context) uint64
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *Uint64Flag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *Uint64Flag) GetDefaultText() string
|
func (f *Uint64Flag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
@ -1680,6 +1771,7 @@ func (f *Uint64Flag) TakesValue() bool
|
|||||||
type UintFlag struct {
|
type UintFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -1702,6 +1794,9 @@ func (f *UintFlag) Apply(set *flag.FlagSet) error
|
|||||||
func (f *UintFlag) Get(ctx *Context) uint
|
func (f *UintFlag) Get(ctx *Context) uint
|
||||||
Get returns the flag’s value in the given Context.
|
Get returns the flag’s value in the given Context.
|
||||||
|
|
||||||
|
func (f *UintFlag) GetCategory() string
|
||||||
|
GetCategory returns the category for the flag
|
||||||
|
|
||||||
func (f *UintFlag) GetDefaultText() string
|
func (f *UintFlag) GetDefaultText() string
|
||||||
GetDefaultText returns the default text for this flag
|
GetDefaultText returns the default text for this flag
|
||||||
|
|
||||||
@ -1741,6 +1836,14 @@ type VisibleFlag interface {
|
|||||||
}
|
}
|
||||||
VisibleFlag is an interface that allows to check if a flag is visible
|
VisibleFlag is an interface that allows to check if a flag is visible
|
||||||
|
|
||||||
|
type VisibleFlagCategory interface {
|
||||||
|
// Name returns the category name string
|
||||||
|
Name() string
|
||||||
|
// Flags returns a slice of VisibleFlag sorted by name
|
||||||
|
Flags() []VisibleFlag
|
||||||
|
}
|
||||||
|
VisibleFlagCategory is a category containing flags.
|
||||||
|
|
||||||
package altsrc // import "github.com/urfave/cli/v2/altsrc"
|
package altsrc // import "github.com/urfave/cli/v2/altsrc"
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import "time"
|
|||||||
type Float64SliceFlag struct {
|
type Float64SliceFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -37,6 +38,7 @@ func (f *Float64SliceFlag) Names() []string {
|
|||||||
type GenericFlag struct {
|
type GenericFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -73,6 +75,7 @@ func (f *GenericFlag) Names() []string {
|
|||||||
type Int64SliceFlag struct {
|
type Int64SliceFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -102,6 +105,7 @@ func (f *Int64SliceFlag) Names() []string {
|
|||||||
type IntSliceFlag struct {
|
type IntSliceFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -131,6 +135,7 @@ func (f *IntSliceFlag) Names() []string {
|
|||||||
type PathFlag struct {
|
type PathFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -167,6 +172,7 @@ func (f *PathFlag) Names() []string {
|
|||||||
type StringSliceFlag struct {
|
type StringSliceFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -198,6 +204,7 @@ func (f *StringSliceFlag) Names() []string {
|
|||||||
type TimestampFlag struct {
|
type TimestampFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -234,6 +241,7 @@ func (f *TimestampFlag) Names() []string {
|
|||||||
type BoolFlag struct {
|
type BoolFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -268,6 +276,7 @@ func (f *BoolFlag) Names() []string {
|
|||||||
type Float64Flag struct {
|
type Float64Flag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -302,6 +311,7 @@ func (f *Float64Flag) Names() []string {
|
|||||||
type IntFlag struct {
|
type IntFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -336,6 +346,7 @@ func (f *IntFlag) Names() []string {
|
|||||||
type Int64Flag struct {
|
type Int64Flag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -370,6 +381,7 @@ func (f *Int64Flag) Names() []string {
|
|||||||
type StringFlag struct {
|
type StringFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -406,6 +418,7 @@ func (f *StringFlag) Names() []string {
|
|||||||
type DurationFlag struct {
|
type DurationFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -440,6 +453,7 @@ func (f *DurationFlag) Names() []string {
|
|||||||
type UintFlag struct {
|
type UintFlag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
@ -474,6 +488,7 @@ func (f *UintFlag) Names() []string {
|
|||||||
type Uint64Flag struct {
|
type Uint64Flag struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
||||||
|
Category string
|
||||||
DefaultText string
|
DefaultText string
|
||||||
FilePath string
|
FilePath string
|
||||||
Usage string
|
Usage string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user