ATTN: This project uses semantic versioning.
HandleExitCoder
is now correctly iterates over all errors in
a MultiError
. The exit code is the exit code of the last error or 1
if
there are no ExitCoder
s in the MultiError
.Usage
, Description
, ArgsUsage
, OnUsageError
correctly
propogatedErrWriter
is now passed downwards through command structure to avoid the
need to redefine itCommand
context into OnUsageError
rather than parent context so that
all fields are avaiableBefore
funcs are no longer double printedUsageText
in the help templates for commands and subcommands if
defined; otherwise build the usage as before (was previously ignoring this
field)IsSet
and GlobalIsSet
now correctly return whether a flag is set if
a program calls Set
or GlobalSet
directly after flag parsing (would
previously only return true
if the flag was set during parsing)OsExiter
. This exiting behavior was introduced in 1.19.0, but was
determined to be a regression in functionality. See the
PR for discussion.CommandsByName
type was added to make it easy to sort Command
s by name,
alphabeticallyaltsrc
now handles loading of string and int arrays from TOMLApp
via
CustomAppHelpTemplate
App
to be used with
CustomAppHelpTemplate
via ExtraInfo
HelpFlag
, VersionFlag
, and BashCompletionFlag
changed to explictly be
cli.Flag
s allowing for the use of custom flags satisfying the cli.Flag
interface to be used.ActionFunc
as
the Action
for a command would cause it to error rather than calling the
function. Should not have a affected declarative cases using func(c *cli.Context) err)
.--generate-bash-completion
immediately after a flag that takes an argument.
Previously it call the application with --generate-bash-completion
as the
flag value.FlagsByName
was added to make it easy to sort flags (e.g. sort.Sort(cli.FlagsByName(app.Flags))
)Description
field was added to App
for a more detailed description of
the application (similar to the existing Description
field on Command
)go generate
altsrc
loaderSkipArgReorder
was added to allow users to skip the argument reordering.
This is useful if you want to consider all "flags" after an argument as
arguments rather than flags (the default behavior of the stdlib flag
library). This is backported functionality from the removal of the flag
reordering in the unreleased version
2ErrorFormatter
), the errors will
be formatted during output. Compatible with pkg/errors
.""
would be skipped rather than their value used).App.Writer
defaults to stdout
when nil
panic
ingApp.Metadata
is initialized automatically now (previously was nil
unless initialized)-h
is provided to a subcommandcontext.(Global)IsSet
now respects environment variables. Previously it
would return false
if a flag was specified in the environment rather than
as an argumentaltsrc
s import paths were updated to use gopkg.in/urfave/cli.v1
. This
fixes issues that occurred when gopkg.in/urfave/cli.v1
was imported as well
as altsrc
where Go would complain that the types didn't match./runtests
test runner with coverage tracking by defaultUintFlag
, Uint64Flag
, and Int64Flag
types and supporting codehelp
subcommand when using CommandCategories
panic
s that occur within the Action
s themselves when
detecting the signature of the Action
fieldcli.DefaultFlagStringFunc
context.GlobalBoolT
was added as an analogue to context.GlobalBool
Hidden: true
-- this will hide the
commands in help outputFloat64Flag
, IntFlag
, and DurationFlag
default values are no longer
quoted in help text output.(default: {value})
strings following usage when a
default value can be (reasonably) detected.IntSliceFlag
and StringSliceFlag
usage strings are now more consistent
with non-slice flag typescli
since they can trust
that a 0 exit code indicated a successful execution.Hidden
field on all flag struct types to omit from generated help textBashCompletionFlag
(--enable-bash-completion
) is now omitted from
generated help text via the Hidden
fieldHandleAction
and HandleExitCoder
App.Metadata
map for arbitrary data/state managementSet
and GlobalSet
methods on *cli.Context
for altering values after
parsing.App.Action
and Command.Action
now prefer a return signature of
func(*cli.Context) error
, as defined by cli.ActionFunc
. If a non-nil
error
is returned, there may be two outcomes:
cli.ExitCoder
, then os.Exit
will be called
automaticallyApp.Run
Action
with the legacy return signature of
func(*cli.Context)
will produce a deprecation message to stderrAction
that is not a func
type will produce a non-zero exit
from App.Run
Action
func that has an invalid (input) signature will
produce a non-zero exit from App.Run
cli.App.RunAndExitOnError
, which should now be done by returning an error
that fulfills cli.ExitCoder
to cli.App.Run
.cli.App.Action
of func(*cli.Context)
, which should now have a return
signature of func(*cli.Context) error
, as defined by cli.ActionFunc
.*cli.Context.GlobalFloat64
methodCategorizedHelp
and Categories
on app.filepath.Base
instead of path.Base
in Name
and HelpName
.HideVersion
set.NArg
method on context.USAGE
section of help output.panic
from default help printer func.Before
/After
at command level when no subcommands.-
argument causing flag reordering.path.Base
in Name
and HelpName
GetName
on flag types.tip
in Travis CI config.ArgsUsage
at app and command level for help text flexibility.HideHelp
and HideVersion
in App.Run
.FullName
on command with accompanying help output update.$PROG
in bash completion.Copyright
at app level.Parent
func at context level to walk up context lineage.Before
/After
funcs.HelpPrinter
signature includes output writer.Writer
when running command as app.NumFlags
at context level.Aliases
at command level.ShortName
at command level.Author
and Email
fields.Names
/Aliases
.After
hook func support at app and command level.-h / --help
flags, but not help
subcommand.--
.ParseInt
instead of ParseUint
for int environment var values.0
as base when parsing int environment var values.Stdout
on app for output redirection.ShowCommandHelp
.-v / --version
flag made optional.FlagNames
at context level.VersionPrinter
var for more control over version output.AUTHOR
section in default app help template.DurationFlag
type.Author
, Email
, and Compiled
metadata on app.Before
hook func support at app and command level.CommandNotFound
func support at app level.GenericFlag
type.Float64Flag
type.BoolTFlag
type.IsSet
flag helper on context.HelpPrinter
var for more control over help output.help
flag in default app flag set and each command flag set.StringSliceFlag
type and supporting StringSlice
type.IntSliceFlag
type and supporting IntSlice
type.