Releases: urfave/cli
Releases · urfave/cli
cli v1.19.1
Fixed
- Fixes regression introduced in 1.19.0 where using an
ActionFunc
as
theAction
for a command would cause it to error rather than calling the
function. Should not have a affected declarative cases usingfunc(c *cli.Context) err)
. - Shell completion now handles the case where the user specifies
--generate-bash-completion
immediately after a flag that takes an argument.
Previously it call the application with--generate-bash-completion
as the
flag value.
cli v1.19.0
Added
FlagsByName
was added to make it easy to sort flags (e.g.sort.Sort(cli.FlagsByName(app.Flags))
)- A
Description
field was added toApp
for a more detailed description of
the application (similar to the existingDescription
field onCommand
) - Flag type code generation via
go generate
- Write to stderr and exit 1 if action returns non-nil error
- Added support for TOML to the
altsrc
loader SkipArgReorder
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 stdlibflag
library). This is backported functionality from the removal of the flag
reordering in the unreleased version
2- For formatted errors (those implementing
ErrorFormatter
), the errors will
be formatted during output. Compatible withpkg/errors
.
Changed
- Raise minimum tested/supported Go version to 1.2+
Fixed
- Consider empty environment variables as set (previously environment variables
with the equivalent of""
would be skipped rather than their value used). - Return an error if the value in a given environment variable cannot be parsed
as the flag type. Previously these errors were silently swallowed. - Print full error when an invalid flag is specified (which includes the invalid flag)
App.Writer
defaults tostdout
whennil
- If no action is specified on a command or app, the help is now printed instead of
panic
ing App.Metadata
is initialized automatically now (previously wasnil
unless initialized)- Correctly show help message if
-h
is provided to a subcommand context.(Global)IsSet
now respects environment variables. Previously it
would returnfalse
if a flag was specified in the environment rather than
as an argument- Removed deprecation warnings to STDERR to avoid them leaking to the end-user
altsrc
s import paths were updated to usegopkg.in/urfave/cli.v1
. This
fixes issues that occurred whengopkg.in/urfave/cli.v1
was imported as well
asaltsrc
where Go would complain that the types didn't match
cli v1.18.1
Fixed
- Removed deprecation warnings to STDERR to avoid them leaking to the end-user (backported)
cli v1.17.1
Fixed
- Removed deprecation warnings to STDERR to avoid them leaking to the end-user (backported)
cli v1.16.1
Fixed
- Removed deprecation warnings to STDERR to avoid them leaking to the end-user (backported)
v1.18.0
Added
./runtests
test runner with coverage tracking by default- testing on OS X
- testing on Windows
UintFlag
,Uint64Flag
, andInt64Flag
types and supporting code
Changed
- Use spaces for alignment in help/usage output instead of tabs, making the
output alignment consistent regardless of tab width
Fixed
- Printing of command aliases in help text
- Printing of visible flags for both struct and struct pointer flags
- Display the
help
subcommand when usingCommandCategories
- No longer swallows
panic
s that occur within theAction
s themselves when
detecting the signature of theAction
field
v1.17.0
Added
- Pluggable flag-level help text rendering via
cli.DefaultFlagStringFunc
context.GlobalBoolT
was added as an analogue tocontext.GlobalBool
- Support for hiding commands by setting
Hidden: true
-- this will hide the
commands in help output
Changed
Float64Flag
,IntFlag
, andDurationFlag
default values are no longer
quoted in help text output.- All flag types now include
(default: {value})
strings following usage when a
default value can be (reasonably) detected. IntSliceFlag
andStringSliceFlag
usage strings are now more consistent
with non-slice flag types- Apps now exit with a code of 3 if an unknown subcommand is specified
(previously they printed "No help topic for...", but still exited 0. This
makes it easier to script around apps built usingcli
since they can trust
that a 0 exit code indicated a successful execution. - cleanups based on Go Report Card
feedback
v1.16.0
Added
Hidden
field on all flag struct types to omit from generated help text
Changed
BashCompletionFlag
(--enable-bash-completion
) is now omitted from
generated help text via theHidden
field
Fixed
- handling of error values in
HandleAction
andHandleExitCoder
v1.15.0
Added
- A
CHANGELOG.md
file! - Support for placeholders in flag usage strings
App.Metadata
map for arbitrary data/state managementSet
andGlobalSet
methods on*cli.Context
for altering values after
parsing.- Support for nested lookup of dot-delimited keys in structures loaded from
YAML.
Changed
- The
App.Action
andCommand.Action
now prefer a return signature of
func(*cli.Context) error
, as defined bycli.ActionFunc
. If a non-nil
error
is returned, there may be two outcomes:- If the error fulfills
cli.ExitCoder
, thenos.Exit
will be called
automatically - Else the error is bubbled up and returned from
App.Run
- If the error fulfills
- Specifying an
Action
with the legacy return signature of
func(*cli.Context)
will produce a deprecation message to stderr - Specifying an
Action
that is not afunc
type will produce a non-zero exit
fromApp.Run
- Specifying an
Action
func that has an invalid (input) signature will
produce a non-zero exit fromApp.Run
Deprecated
cli.App.RunAndExitOnError
, which should now be done by returning an error
that fulfillscli.ExitCoder
tocli.App.Run
.- the legacy signature for
cli.App.Action
offunc(*cli.Context)
, which should now have a return
signature offunc(*cli.Context) error
, as defined bycli.ActionFunc
.
Fixed
- Added missing
*cli.Context.GlobalFloat64
method