Commit Graph

50 Commits

Author SHA1 Message Date
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
2016-08-28 03:14:39 -04:00
Bruno França dos Reis
028af4bc35 adding support for Float64SliceFlag 2016-06-28 19:52:25 -07:00
Dan Buch
0c9b549918
Ensure remaining v1 additions are v2 compatible 2016-06-17 09:54:54 -04:00
Dan Buch
6c628a1a88
Merge remote-tracking branch 'origin/v1' into merging-from-v1 2016-06-17 09:11:36 -04: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
3b03164c92 Merge branch 'v2' into show-bool-default 2016-05-28 04:49:10 -04:00
c70993dbc5 Merge branch 'v2' into minimize-struct-copying 2016-05-23 22:08:59 -04:00
Dan Buch
8f25dbb615
Ensure all flag aliases are set when Destination given
and extend "Incorrect Usage" message to show the error.

Closes #430
2016-05-23 22:00:59 -04:00
Dan Buch
cd10b49473
Minimize struct copying
by using pointer func receivers and slices of struct pointers where possible.
2016-05-22 15:20:52 -04:00
Dan Buch
81fcf706ea
Replace all "stringly typed" fields with slice equivalents
and alter the Flag interface accordingly

Closes #415
2016-05-21 21:29:45 -04:00
Dan Buch
fac67ac91a
Show BoolFlag default value in help usage
now that BoolTFlag is gone
2016-05-21 20:02:08 -04:00
Dan Buch
9c132d990a
Add more tests for BoolFlag{Value: true} 2016-05-18 08:30:28 -04:00
Dan Buch
f2d5ed9933
Replace BoolTFlag type with BoolFlag.Value
Closes #412
2016-05-18 08:20:15 -04:00
Dan Buch
c19dbaf230
Remove deprecated things and supporting code 2016-05-17 15:11:44 -04:00
Dan Buch
a1e5328e30
Merge remote-tracking branch 'origin/master' into string-slice-flag-default-160 2016-05-03 05:25:07 -04: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
1fb52b3bce
Merge remote-tracking branch 'origin/master' into string-slice-flag-default-160 2016-04-30 13:13:02 -04:00
Dan Buch
1a91f3dce5
Ensure IntSlice & StringSlice serialization works as expected 2016-04-29 02:53:58 -04:00
Dan Buch
64de53e639
Merge remote-tracking branch 'origin/master' into string-slice-flag-default-160 2016-04-28 11:11:42 -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
Dan Buch
cb433e7468 Use NewIntSlice and NewStringSlice internally 2016-04-05 22:38:31 -04:00
Dan Buch
867aa0912d Overwrite slice flag defaults when set
Closes #160
2016-04-05 12:35:30 -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