Vladislav Mitov
0b665e6170
Add PathFlag
7 years ago
Dan Buch
65b801c818
Resolve remaining test errors for v1 => v2 merge
7 years ago
Dan Buch
47a412375f
Resolved compile-time errors since merging from v1
7 years ago
Dan Buch
a61867e5e6
Merge remote-tracking branch 'origin/v1' into merging-from-v1
7 years ago
Jesse Szwedko
8d8f927bcb
Change flag test error checking to use regexp rather than strings
...
As the error messages changed in 1.8
8 years ago
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.
8 years ago
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.
8 years ago
Jake Champlin
7d56512ecc
Add documentation, remove quotes by default
8 years ago
Jake Champlin
e0556cf9e8
Add DefaultValue text for flags
...
Allows a user to override the default value of a flag in the displayed help output.
Ex:
```
cli.IntFlag{
Name: "foo, f",
DefaultText: "random foo",
Value: "bar",
}
```
Running `(app.name) -h` will now yield:
```
--foo value (default: "random foo")
```
Fixes : #504
8 years ago
Bruno França dos Reis
028af4bc35
adding support for Float64SliceFlag
8 years ago
Dan Buch
0c9b549918
Ensure remaining v1 additions are v2 compatible
8 years ago
Dan Buch
6c628a1a88
Merge remote-tracking branch 'origin/v1' into merging-from-v1
8 years ago
Dan Buch
a0e694ed72
Add UintFlag, Uint64Flag types and supporting code
8 years ago
Bruno França dos Reis
5c7cca7f16
Adding Int64Slice related stuff in flag.go and context.go, and related tests
8 years ago
Bruno França dos Reis
4962423cba
Adding Int64Flag type and related tests
8 years ago
Dan Buch
3b03164c92
Merge branch 'v2' into show-bool-default
8 years ago
Dan Buch
c70993dbc5
Merge branch 'v2' into minimize-struct-copying
8 years ago
Dan Buch
8f25dbb615
Ensure all flag aliases are set when Destination given
...
and extend "Incorrect Usage" message to show the error.
Closes #430
8 years ago
Dan Buch
cd10b49473
Minimize struct copying
...
by using pointer func receivers and slices of struct pointers where possible.
8 years ago
Dan Buch
81fcf706ea
Replace all "stringly typed" fields with slice equivalents
...
and alter the Flag interface accordingly
Closes #415
8 years ago
Dan Buch
fac67ac91a
Show BoolFlag default value in help usage
...
now that BoolTFlag is gone
8 years ago
Dan Buch
9c132d990a
Add more tests for BoolFlag{Value: true}
8 years ago
Dan Buch
f2d5ed9933
Replace BoolTFlag type with BoolFlag.Value
...
Closes #412
8 years ago
Dan Buch
c19dbaf230
Remove deprecated things and supporting code
8 years ago
Dan Buch
a1e5328e30
Merge remote-tracking branch 'origin/master' into string-slice-flag-default-160
9 years ago
Dan Buch
69a8e25f3d
Make flag usage rendering more consistent; show default values
9 years ago
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
9 years ago
Dan Buch
1fb52b3bce
Merge remote-tracking branch 'origin/master' into string-slice-flag-default-160
9 years ago
Dan Buch
1a91f3dce5
Ensure IntSlice & StringSlice serialization works as expected
9 years ago
Dan Buch
64de53e639
Merge remote-tracking branch 'origin/master' into string-slice-flag-default-160
9 years ago
Dan Buch
23c7b807a7
Merge remote-tracking branch 'origin/master' into txgruppi-develop
9 years ago
Dan Buch
b7329f4968
Switch from multi-return with exit codes to ExitCoder check
9 years ago
Dan Buch
10c8309d84
Merge branch 'develop' of https://github.com/txgruppi/cli into txgruppi-develop
9 years ago
Kevin Cantwell
13b7eedc13
Parses usage placeholders via back quotes. Resolves #333
9 years ago
Dan Buch
cb433e7468
Use NewIntSlice and NewStringSlice internally
9 years ago
Dan Buch
867aa0912d
Overwrite slice flag defaults when set
...
Closes #160
9 years ago
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)
9 years ago
ston1th
25ef368235
added destination scan testing and BoolT
9 years ago
Tarcísio Gruppi
1510d7e722
Updated tests to support exit code
9 years ago
Edward Sheffler III
8ea1232ede
Improve vendoring options by removing self-referential imports in tests.
9 years ago
jszwedko
059c02782a
Use double quotes in output for defaults
...
Windows doesn't recognize 's for wrapping values. "s should work on all
systems.
10 years ago
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.
10 years ago
Dan Buch
78d497e4cf
Adding support for multiple env var "cascade"
10 years ago
Ghislain Gt
98af61a59f
Add time.Duration flag type
10 years ago
Dan Buch
48869e13a4
Addressing `go vet` offenses
10 years ago
Dan Buch
fc16c67be3
Updating structs to use labels, adding tests for env stuff
10 years ago
Summer Mousa
1eaa882c3a
removed extranneous value method on the generic type
11 years ago
Summer Mousa
13e88629f5
Generic parsers as flag types
11 years ago
Ryan Schmukler
312151dca4
remove quotes for empty StringFlags
11 years ago
Yicheng Qin
ce13660ae0
fix(context): copy StringSlice Flag correctly
11 years ago