Lynn Cyrin
f7d5e2c21e
reduce diff
2019-07-11 20:22:16 -07:00
Lynn Cyrin
e6842c0b75
merge in test file
2019-07-11 20:21:05 -07:00
baude
fd5382e7a5
Combine bool short names
...
Adds the ability to allow the combination of bool
short-name options. For example,
cmd foobar -ov
This is done through a bool "UseShortOptionHandler" set in
the command struct.
Built upon PR #621
Signed-off-by: baude <bbaude@redhat.com>
2017-11-13 16:29:20 -06:00
Jacob McCann
f971fca2b2
Allow FilePath to take []string
2017-10-31 10:43:11 -05:00
Brad Rydzewski
18a556e192
fix FilePath documentation in README.md
2017-10-31 10:29:11 -05:00
Brad Rydzewski
c698b821b8
unit tests for load from file
2017-10-31 10:29:11 -05:00
Brad Rydzewski
21fcab0dee
ability to load variable from file
2017-10-31 10:29:11 -05:00
Robert Liebowitz
cbbe4c1a2c
Add tests for custom flag prefix/env hints
2017-09-18 00:44:42 -04:00
Jesse Szwedko
8d8f927bcb
Change flag test error checking to use regexp rather than strings
...
As the error messages changed in 1.8
2017-03-04 14:28:24 -08:00
Jesse Szwedko
e367fafa3d
Return an error when parsing environment variables for values fails
...
Currently cli silently (aside from IntSlice and Int64Slice which oddly
printed directly to the error stream) ignores failures that occur when
parsing environment variables for their value for flags that define
environment variables. Instead, we should propogate up the error to the
user.
This is accomplished in a backwards compatible manner by adding a new,
internal, interface which defines an applyWithError function that all
flags here define. In v2, when we can modify the interface, we can drop
this secondary interface and modify `Apply` to return an error.
2016-11-13 14:59:35 -08:00
Jesse Szwedko
a00c3f5872
Consider empty environment variables as set
...
When assigning values to flags (also when interogatting via
`context.(Global)IsSet`.
For boolean flags, consider empty as `false`.
Using `syscall.Getenv` rather than `os.LookupEnv` in order to support
older Golang versions.
2016-11-13 14:59:27 -08:00
Dan Buch
a0e694ed72
Add UintFlag, Uint64Flag types and supporting code
2016-06-16 11:13:32 -04:00
Bruno França dos Reis
5c7cca7f16
Adding Int64Slice related stuff in flag.go and context.go, and related tests
2016-06-11 21:54:33 -07:00
Bruno França dos Reis
4962423cba
Adding Int64Flag type and related tests
2016-06-11 15:22:07 -07:00
Dan Buch
69a8e25f3d
Make flag usage rendering more consistent; show default values
2016-05-02 19:42:08 -04:00
Dan Buch
22773b14c1
Allow for pluggable flag-level help text formatting
...
by defining `cli.DefaultFlagStringFunc` with a default value that uses
`withEnvHint`, conditionally running a given flag's `FormatValueHelp` if
present.
Closes #257
2016-05-02 13:05:21 -04:00
Dan Buch
23c7b807a7
Merge remote-tracking branch 'origin/master' into txgruppi-develop
2016-04-27 09:30:05 -04:00
Dan Buch
b7329f4968
Switch from multi-return with exit codes to ExitCoder check
2016-04-27 09:12:34 -04:00
Dan Buch
10c8309d84
Merge branch 'develop' of https://github.com/txgruppi/cli into txgruppi-develop
2016-04-25 18:10:10 -04:00
Kevin Cantwell
13b7eedc13
Parses usage placeholders via back quotes. Resolves #333
2016-04-21 23:04:01 -04:00
Gregor Noczinski
82ddbd9a07
* Improve GenericFlag.String() by suppressing empty "" for GenericFlags on nil or empty Generic.String()
...
* Cleanup StringFlag.String()
* Add os specific envHint handling for Windows (%ENV_VAR% instead of $ENV_VAR on posix systems)
2016-01-22 15:08:27 +01:00
ston1th
25ef368235
added destination scan testing and BoolT
2015-11-14 22:39:38 +01:00
Tarcísio Gruppi
1510d7e722
Updated tests to support exit code
2015-07-28 20:29:13 +02:00
Edward Sheffler III
8ea1232ede
Improve vendoring options by removing self-referential imports in tests.
2015-07-20 12:28:51 -07:00
jszwedko
059c02782a
Use double quotes in output for defaults
...
Windows doesn't recognize 's for wrapping values. "s should work on all
systems.
2015-01-08 15:35:23 -05:00
jszwedko
22dbe6ffdc
Fix help text for generic flag to not insinuate that you can specify multiple
...
Feels like it may have been copied from StringSliceFlag or something,
but update the output to be more consistent with other single value
flags.
Also added comments to the String and Apply functions.
2015-01-08 14:27:09 -05:00
78d497e4cf
Adding support for multiple env var "cascade"
2014-09-22 23:28:57 -04:00
Ghislain Gt
98af61a59f
Add time.Duration flag type
2014-08-02 22:32:32 +01:00
48869e13a4
Addressing go vet
offenses
2014-07-11 18:30:16 -04:00
fc16c67be3
Updating structs to use labels, adding tests for env stuff
2014-07-11 18:13:10 -04:00
Summer Mousa
1eaa882c3a
removed extranneous value method on the generic type
2014-04-15 09:57:11 -05:00
Summer Mousa
13e88629f5
Generic parsers as flag types
2014-04-15 09:16:47 -05:00
Ryan Schmukler
312151dca4
remove quotes for empty StringFlags
2014-04-11 15:16:09 -04:00
Yicheng Qin
ce13660ae0
fix(context): copy StringSlice Flag correctly
2014-03-21 17:18:14 -07:00
Katrina Owen
2ec51afe91
Implement Float64Flag. See #46
2013-12-03 05:42:26 -08:00
Jeremy Saenz
806cdc2890
removed dead test
2013-11-20 17:26:27 -08:00
Jeremy Saenz
ab6f1b7c3c
Formatting
2013-11-20 17:25:13 -08:00
Jared Forsyth
dc8a62e0e9
refactor, more robust flag propagation
2013-11-20 01:05:18 -07:00
Jared Forsyth
73e88630a5
fmt
2013-11-18 16:37:59 -07:00
Jared Forsyth
ccb1528bb0
adding multi-named flags
2013-11-18 16:35:23 -07:00
Jeremy Saenz
0d3c3f4497
Improved documentation
2013-11-01 07:31:37 -07:00
Mike Gehard
1a1d6bd163
Vary flag prefix based on name length
2013-09-09 11:52:12 -07:00