make v2approve
This commit is contained in:
parent
47d325e64f
commit
76769bafc7
@ -55,8 +55,8 @@ GLOBAL OPTIONS:{{template "visibleFlagTemplate" .}}{{end}}{{if .Copyright}}
|
|||||||
COPYRIGHT:
|
COPYRIGHT:
|
||||||
{{template "copyrightTemplate" .}}{{end}}
|
{{template "copyrightTemplate" .}}{{end}}
|
||||||
`
|
`
|
||||||
AppHelpTemplate is the text template for the Default help topic. cli.go
|
AppHelpTemplate is the text template for the Default help topic. cli.go uses
|
||||||
uses text/template to render templates. You can render custom help text by
|
text/template to render templates. You can render custom help text by
|
||||||
setting this variable.
|
setting this variable.
|
||||||
|
|
||||||
var CommandHelpTemplate = `NAME:
|
var CommandHelpTemplate = `NAME:
|
||||||
@ -184,9 +184,9 @@ func DefaultAppComplete(cCtx *Context)
|
|||||||
func DefaultCompleteWithFlags(cmd *Command) func(cCtx *Context)
|
func DefaultCompleteWithFlags(cmd *Command) func(cCtx *Context)
|
||||||
func FlagNames(name string, aliases []string) []string
|
func FlagNames(name string, aliases []string) []string
|
||||||
func HandleAction(action interface{}, cCtx *Context) (err error)
|
func HandleAction(action interface{}, cCtx *Context) (err error)
|
||||||
HandleAction attempts to figure out which Action signature was used.
|
HandleAction attempts to figure out which Action signature was used. If it's
|
||||||
If it's an ActionFunc or a func with the legacy signature for Action,
|
an ActionFunc or a func with the legacy signature for Action, the func is
|
||||||
the func is run!
|
run!
|
||||||
|
|
||||||
func HandleExitCoder(err error)
|
func HandleExitCoder(err error)
|
||||||
HandleExitCoder handles errors implementing ExitCoder by printing their
|
HandleExitCoder handles errors implementing ExitCoder by printing their
|
||||||
@ -355,14 +355,14 @@ func (a *App) RunAsSubcommand(ctx *Context) (err error)
|
|||||||
Deprecated: use App.Run or App.RunContext
|
Deprecated: use App.Run or App.RunContext
|
||||||
|
|
||||||
func (a *App) RunContext(ctx context.Context, arguments []string) (err error)
|
func (a *App) RunContext(ctx context.Context, arguments []string) (err error)
|
||||||
RunContext is like Run except it takes a Context that will be passed to
|
RunContext is like Run except it takes a Context that will be passed to its
|
||||||
its commands and sub-commands. Through this, you can propagate timeouts and
|
commands and sub-commands. Through this, you can propagate timeouts and
|
||||||
cancellation requests
|
cancellation requests
|
||||||
|
|
||||||
func (a *App) Setup()
|
func (a *App) Setup()
|
||||||
Setup runs initialization code to ensure all data structures are ready
|
Setup runs initialization code to ensure all data structures are ready for
|
||||||
for `Run` or inspection prior to `Run`. It is internally called by `Run`,
|
`Run` or inspection prior to `Run`. It is internally called by `Run`, but
|
||||||
but will return early if setup has already happened.
|
will return early if setup has already happened.
|
||||||
|
|
||||||
func (a *App) ToFishCompletion() (string, error)
|
func (a *App) ToFishCompletion() (string, error)
|
||||||
ToFishCompletion creates a fish completion string for the `*App` The
|
ToFishCompletion creates a fish completion string for the `*App` The
|
||||||
@ -841,9 +841,9 @@ func Exit(message interface{}, exitCode int) ExitCoder
|
|||||||
Exit wraps a message and exit code into an error, which by default is
|
Exit wraps a message and exit code into an error, which by default is
|
||||||
handled with a call to os.Exit during default error handling.
|
handled with a call to os.Exit during default error handling.
|
||||||
|
|
||||||
This is the simplest way to trigger a non-zero exit code for an App
|
This is the simplest way to trigger a non-zero exit code for an App without
|
||||||
without having to call os.Exit manually. During testing, this behavior
|
having to call os.Exit manually. During testing, this behavior can be
|
||||||
can be avoided by overriding the ExitErrHandler function on an App or the
|
avoided by overriding the ExitErrHandler function on an App or the
|
||||||
package-global OsExiter function.
|
package-global OsExiter function.
|
||||||
|
|
||||||
func NewExitError(message interface{}, exitCode int) ExitCoder
|
func NewExitError(message interface{}, exitCode int) ExitCoder
|
||||||
@ -1532,8 +1532,8 @@ type MultiInt64Flag = SliceFlag[*Int64SliceFlag, []int64, int64]
|
|||||||
directly, as Value and/or Destination. See also SliceFlag.
|
directly, as Value and/or Destination. See also SliceFlag.
|
||||||
|
|
||||||
type MultiIntFlag = SliceFlag[*IntSliceFlag, []int, int]
|
type MultiIntFlag = SliceFlag[*IntSliceFlag, []int, int]
|
||||||
MultiIntFlag extends IntSliceFlag with support for using slices directly,
|
MultiIntFlag extends IntSliceFlag with support for using slices directly, as
|
||||||
as Value and/or Destination. See also SliceFlag.
|
Value and/or Destination. See also SliceFlag.
|
||||||
|
|
||||||
type MultiStringFlag = SliceFlag[*StringSliceFlag, []string, string]
|
type MultiStringFlag = SliceFlag[*StringSliceFlag, []string, string]
|
||||||
MultiStringFlag extends StringSliceFlag with support for using slices
|
MultiStringFlag extends StringSliceFlag with support for using slices
|
||||||
@ -1620,8 +1620,8 @@ type RequiredFlag interface {
|
|||||||
|
|
||||||
IsRequired() bool
|
IsRequired() bool
|
||||||
}
|
}
|
||||||
RequiredFlag is an interface that allows us to mark flags as required
|
RequiredFlag is an interface that allows us to mark flags as required it
|
||||||
it allows flags required flags to be backwards compatible with the Flag
|
allows flags required flags to be backwards compatible with the Flag
|
||||||
interface
|
interface
|
||||||
|
|
||||||
type Serializer interface {
|
type Serializer interface {
|
||||||
@ -1634,9 +1634,9 @@ type SliceFlag[T SliceFlagTarget[E], S ~[]E, E any] struct {
|
|||||||
Value S
|
Value S
|
||||||
Destination *S
|
Destination *S
|
||||||
}
|
}
|
||||||
SliceFlag extends implementations like StringSliceFlag and IntSliceFlag
|
SliceFlag extends implementations like StringSliceFlag and IntSliceFlag with
|
||||||
with support for using slices directly, as Value and/or Destination.
|
support for using slices directly, as Value and/or Destination. See also
|
||||||
See also SliceFlagTarget, MultiStringFlag, MultiFloat64Flag, MultiInt64Flag,
|
SliceFlagTarget, MultiStringFlag, MultiFloat64Flag, MultiInt64Flag,
|
||||||
MultiIntFlag.
|
MultiIntFlag.
|
||||||
|
|
||||||
func (x *SliceFlag[T, S, E]) Apply(set *flag.FlagSet) error
|
func (x *SliceFlag[T, S, E]) Apply(set *flag.FlagSet) error
|
||||||
@ -2312,9 +2312,9 @@ func InitInputSource(flags []cli.Flag, createInputSource func() (InputSourceCont
|
|||||||
that are supported by the input source
|
that are supported by the input source
|
||||||
|
|
||||||
func InitInputSourceWithContext(flags []cli.Flag, createInputSource func(cCtx *cli.Context) (InputSourceContext, error)) cli.BeforeFunc
|
func InitInputSourceWithContext(flags []cli.Flag, createInputSource func(cCtx *cli.Context) (InputSourceContext, error)) cli.BeforeFunc
|
||||||
InitInputSourceWithContext is used to to setup an InputSourceContext on
|
InitInputSourceWithContext is used to to setup an InputSourceContext on a
|
||||||
a cli.Command Before method. It will create a new input source based on
|
cli.Command Before method. It will create a new input source based on the
|
||||||
the func provided with potentially using existing cli.Context values to
|
func provided with potentially using existing cli.Context values to
|
||||||
initialize itself. If there is no error it will then apply the new input
|
initialize itself. If there is no error it will then apply the new input
|
||||||
source to any flags that are supported by the input source
|
source to any flags that are supported by the input source
|
||||||
|
|
||||||
@ -2432,6 +2432,7 @@ type InputSourceContext interface {
|
|||||||
String(name string) (string, error)
|
String(name string) (string, error)
|
||||||
StringSlice(name string) ([]string, error)
|
StringSlice(name string) ([]string, error)
|
||||||
IntSlice(name string) ([]int, error)
|
IntSlice(name string) ([]int, error)
|
||||||
|
Int64Slice(name string) ([]int64, error)
|
||||||
Generic(name string) (cli.Generic, error)
|
Generic(name string) (cli.Generic, error)
|
||||||
Bool(name string) (bool, error)
|
Bool(name string) (bool, error)
|
||||||
|
|
||||||
@ -2489,6 +2490,9 @@ func (f *Int64SliceFlag) Apply(set *flag.FlagSet) error
|
|||||||
Apply saves the flagSet for later usage calls, then calls the wrapped
|
Apply saves the flagSet for later usage calls, then calls the wrapped
|
||||||
Int64SliceFlag.Apply
|
Int64SliceFlag.Apply
|
||||||
|
|
||||||
|
func (f *Int64SliceFlag) ApplyInputSourceValue(cCtx *cli.Context, isc InputSourceContext) error
|
||||||
|
ApplyInputSourceValue applies a Int64Slice value if required
|
||||||
|
|
||||||
type IntFlag struct {
|
type IntFlag struct {
|
||||||
*cli.IntFlag
|
*cli.IntFlag
|
||||||
// Has unexported fields.
|
// Has unexported fields.
|
||||||
@ -2549,6 +2553,10 @@ func (fsm *MapInputSource) Generic(name string) (cli.Generic, error)
|
|||||||
func (fsm *MapInputSource) Int(name string) (int, error)
|
func (fsm *MapInputSource) Int(name string) (int, error)
|
||||||
Int returns an int from the map if it exists otherwise returns 0
|
Int returns an int from the map if it exists otherwise returns 0
|
||||||
|
|
||||||
|
func (fsm *MapInputSource) Int64Slice(name string) ([]int64, error)
|
||||||
|
Int64Slice returns an []int64 from the map if it exists otherwise returns
|
||||||
|
nil
|
||||||
|
|
||||||
func (fsm *MapInputSource) IntSlice(name string) ([]int, error)
|
func (fsm *MapInputSource) IntSlice(name string) ([]int, error)
|
||||||
IntSlice returns an []int from the map if it exists otherwise returns nil
|
IntSlice returns an []int from the map if it exists otherwise returns nil
|
||||||
|
|
||||||
|
54
testdata/godoc-v2.x.txt
vendored
54
testdata/godoc-v2.x.txt
vendored
@ -55,8 +55,8 @@ GLOBAL OPTIONS:{{template "visibleFlagTemplate" .}}{{end}}{{if .Copyright}}
|
|||||||
COPYRIGHT:
|
COPYRIGHT:
|
||||||
{{template "copyrightTemplate" .}}{{end}}
|
{{template "copyrightTemplate" .}}{{end}}
|
||||||
`
|
`
|
||||||
AppHelpTemplate is the text template for the Default help topic. cli.go
|
AppHelpTemplate is the text template for the Default help topic. cli.go uses
|
||||||
uses text/template to render templates. You can render custom help text by
|
text/template to render templates. You can render custom help text by
|
||||||
setting this variable.
|
setting this variable.
|
||||||
|
|
||||||
var CommandHelpTemplate = `NAME:
|
var CommandHelpTemplate = `NAME:
|
||||||
@ -184,9 +184,9 @@ func DefaultAppComplete(cCtx *Context)
|
|||||||
func DefaultCompleteWithFlags(cmd *Command) func(cCtx *Context)
|
func DefaultCompleteWithFlags(cmd *Command) func(cCtx *Context)
|
||||||
func FlagNames(name string, aliases []string) []string
|
func FlagNames(name string, aliases []string) []string
|
||||||
func HandleAction(action interface{}, cCtx *Context) (err error)
|
func HandleAction(action interface{}, cCtx *Context) (err error)
|
||||||
HandleAction attempts to figure out which Action signature was used.
|
HandleAction attempts to figure out which Action signature was used. If it's
|
||||||
If it's an ActionFunc or a func with the legacy signature for Action,
|
an ActionFunc or a func with the legacy signature for Action, the func is
|
||||||
the func is run!
|
run!
|
||||||
|
|
||||||
func HandleExitCoder(err error)
|
func HandleExitCoder(err error)
|
||||||
HandleExitCoder handles errors implementing ExitCoder by printing their
|
HandleExitCoder handles errors implementing ExitCoder by printing their
|
||||||
@ -355,14 +355,14 @@ func (a *App) RunAsSubcommand(ctx *Context) (err error)
|
|||||||
Deprecated: use App.Run or App.RunContext
|
Deprecated: use App.Run or App.RunContext
|
||||||
|
|
||||||
func (a *App) RunContext(ctx context.Context, arguments []string) (err error)
|
func (a *App) RunContext(ctx context.Context, arguments []string) (err error)
|
||||||
RunContext is like Run except it takes a Context that will be passed to
|
RunContext is like Run except it takes a Context that will be passed to its
|
||||||
its commands and sub-commands. Through this, you can propagate timeouts and
|
commands and sub-commands. Through this, you can propagate timeouts and
|
||||||
cancellation requests
|
cancellation requests
|
||||||
|
|
||||||
func (a *App) Setup()
|
func (a *App) Setup()
|
||||||
Setup runs initialization code to ensure all data structures are ready
|
Setup runs initialization code to ensure all data structures are ready for
|
||||||
for `Run` or inspection prior to `Run`. It is internally called by `Run`,
|
`Run` or inspection prior to `Run`. It is internally called by `Run`, but
|
||||||
but will return early if setup has already happened.
|
will return early if setup has already happened.
|
||||||
|
|
||||||
func (a *App) ToFishCompletion() (string, error)
|
func (a *App) ToFishCompletion() (string, error)
|
||||||
ToFishCompletion creates a fish completion string for the `*App` The
|
ToFishCompletion creates a fish completion string for the `*App` The
|
||||||
@ -841,9 +841,9 @@ func Exit(message interface{}, exitCode int) ExitCoder
|
|||||||
Exit wraps a message and exit code into an error, which by default is
|
Exit wraps a message and exit code into an error, which by default is
|
||||||
handled with a call to os.Exit during default error handling.
|
handled with a call to os.Exit during default error handling.
|
||||||
|
|
||||||
This is the simplest way to trigger a non-zero exit code for an App
|
This is the simplest way to trigger a non-zero exit code for an App without
|
||||||
without having to call os.Exit manually. During testing, this behavior
|
having to call os.Exit manually. During testing, this behavior can be
|
||||||
can be avoided by overriding the ExitErrHandler function on an App or the
|
avoided by overriding the ExitErrHandler function on an App or the
|
||||||
package-global OsExiter function.
|
package-global OsExiter function.
|
||||||
|
|
||||||
func NewExitError(message interface{}, exitCode int) ExitCoder
|
func NewExitError(message interface{}, exitCode int) ExitCoder
|
||||||
@ -1532,8 +1532,8 @@ type MultiInt64Flag = SliceFlag[*Int64SliceFlag, []int64, int64]
|
|||||||
directly, as Value and/or Destination. See also SliceFlag.
|
directly, as Value and/or Destination. See also SliceFlag.
|
||||||
|
|
||||||
type MultiIntFlag = SliceFlag[*IntSliceFlag, []int, int]
|
type MultiIntFlag = SliceFlag[*IntSliceFlag, []int, int]
|
||||||
MultiIntFlag extends IntSliceFlag with support for using slices directly,
|
MultiIntFlag extends IntSliceFlag with support for using slices directly, as
|
||||||
as Value and/or Destination. See also SliceFlag.
|
Value and/or Destination. See also SliceFlag.
|
||||||
|
|
||||||
type MultiStringFlag = SliceFlag[*StringSliceFlag, []string, string]
|
type MultiStringFlag = SliceFlag[*StringSliceFlag, []string, string]
|
||||||
MultiStringFlag extends StringSliceFlag with support for using slices
|
MultiStringFlag extends StringSliceFlag with support for using slices
|
||||||
@ -1620,8 +1620,8 @@ type RequiredFlag interface {
|
|||||||
|
|
||||||
IsRequired() bool
|
IsRequired() bool
|
||||||
}
|
}
|
||||||
RequiredFlag is an interface that allows us to mark flags as required
|
RequiredFlag is an interface that allows us to mark flags as required it
|
||||||
it allows flags required flags to be backwards compatible with the Flag
|
allows flags required flags to be backwards compatible with the Flag
|
||||||
interface
|
interface
|
||||||
|
|
||||||
type Serializer interface {
|
type Serializer interface {
|
||||||
@ -1634,9 +1634,9 @@ type SliceFlag[T SliceFlagTarget[E], S ~[]E, E any] struct {
|
|||||||
Value S
|
Value S
|
||||||
Destination *S
|
Destination *S
|
||||||
}
|
}
|
||||||
SliceFlag extends implementations like StringSliceFlag and IntSliceFlag
|
SliceFlag extends implementations like StringSliceFlag and IntSliceFlag with
|
||||||
with support for using slices directly, as Value and/or Destination.
|
support for using slices directly, as Value and/or Destination. See also
|
||||||
See also SliceFlagTarget, MultiStringFlag, MultiFloat64Flag, MultiInt64Flag,
|
SliceFlagTarget, MultiStringFlag, MultiFloat64Flag, MultiInt64Flag,
|
||||||
MultiIntFlag.
|
MultiIntFlag.
|
||||||
|
|
||||||
func (x *SliceFlag[T, S, E]) Apply(set *flag.FlagSet) error
|
func (x *SliceFlag[T, S, E]) Apply(set *flag.FlagSet) error
|
||||||
@ -2312,9 +2312,9 @@ func InitInputSource(flags []cli.Flag, createInputSource func() (InputSourceCont
|
|||||||
that are supported by the input source
|
that are supported by the input source
|
||||||
|
|
||||||
func InitInputSourceWithContext(flags []cli.Flag, createInputSource func(cCtx *cli.Context) (InputSourceContext, error)) cli.BeforeFunc
|
func InitInputSourceWithContext(flags []cli.Flag, createInputSource func(cCtx *cli.Context) (InputSourceContext, error)) cli.BeforeFunc
|
||||||
InitInputSourceWithContext is used to to setup an InputSourceContext on
|
InitInputSourceWithContext is used to to setup an InputSourceContext on a
|
||||||
a cli.Command Before method. It will create a new input source based on
|
cli.Command Before method. It will create a new input source based on the
|
||||||
the func provided with potentially using existing cli.Context values to
|
func provided with potentially using existing cli.Context values to
|
||||||
initialize itself. If there is no error it will then apply the new input
|
initialize itself. If there is no error it will then apply the new input
|
||||||
source to any flags that are supported by the input source
|
source to any flags that are supported by the input source
|
||||||
|
|
||||||
@ -2432,6 +2432,7 @@ type InputSourceContext interface {
|
|||||||
String(name string) (string, error)
|
String(name string) (string, error)
|
||||||
StringSlice(name string) ([]string, error)
|
StringSlice(name string) ([]string, error)
|
||||||
IntSlice(name string) ([]int, error)
|
IntSlice(name string) ([]int, error)
|
||||||
|
Int64Slice(name string) ([]int64, error)
|
||||||
Generic(name string) (cli.Generic, error)
|
Generic(name string) (cli.Generic, error)
|
||||||
Bool(name string) (bool, error)
|
Bool(name string) (bool, error)
|
||||||
|
|
||||||
@ -2489,6 +2490,9 @@ func (f *Int64SliceFlag) Apply(set *flag.FlagSet) error
|
|||||||
Apply saves the flagSet for later usage calls, then calls the wrapped
|
Apply saves the flagSet for later usage calls, then calls the wrapped
|
||||||
Int64SliceFlag.Apply
|
Int64SliceFlag.Apply
|
||||||
|
|
||||||
|
func (f *Int64SliceFlag) ApplyInputSourceValue(cCtx *cli.Context, isc InputSourceContext) error
|
||||||
|
ApplyInputSourceValue applies a Int64Slice value if required
|
||||||
|
|
||||||
type IntFlag struct {
|
type IntFlag struct {
|
||||||
*cli.IntFlag
|
*cli.IntFlag
|
||||||
// Has unexported fields.
|
// Has unexported fields.
|
||||||
@ -2549,6 +2553,10 @@ func (fsm *MapInputSource) Generic(name string) (cli.Generic, error)
|
|||||||
func (fsm *MapInputSource) Int(name string) (int, error)
|
func (fsm *MapInputSource) Int(name string) (int, error)
|
||||||
Int returns an int from the map if it exists otherwise returns 0
|
Int returns an int from the map if it exists otherwise returns 0
|
||||||
|
|
||||||
|
func (fsm *MapInputSource) Int64Slice(name string) ([]int64, error)
|
||||||
|
Int64Slice returns an []int64 from the map if it exists otherwise returns
|
||||||
|
nil
|
||||||
|
|
||||||
func (fsm *MapInputSource) IntSlice(name string) ([]int, error)
|
func (fsm *MapInputSource) IntSlice(name string) ([]int, error)
|
||||||
IntSlice returns an []int from the map if it exists otherwise returns nil
|
IntSlice returns an []int from the map if it exists otherwise returns nil
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user