Jesse Szwedko
83497d2cda
Merge remote-tracking branch 'origin/master' into v2-merge
2016-10-29 14:13:18 -07:00
Antonio Murdaca
c516bce8f1
flags: provide a type to sort flags
...
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-10-21 10:37:18 +02:00
lewo
6aa0ab6903
Merge branch 'v2' into v2-completion
2016-09-01 09:35:02 +02:00
Jake Champlin
7d56512ecc
Add documentation, remove quotes by default
2016-08-30 10:52:24 -04:00
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
Antoine Eiche
94bc26fd1c
Refactoring names from bash to shell
...
The refactoring is required since completion is also supported for zsh
shell.
Refactoring details:
- flag generate-bash-completion -> generate-completion
- var EnableBashCompletion -> EnableShellCompletion
- var BashComplete -> ShellComplete
- var BashCompletionFlag -> GenerateCompletionFlag
- type BashCompleteFunc -> ShellCompleteFunc
2016-07-26 15:32:03 +02:00
Antoine Eiche
7640bef0eb
Add --init-completion flag to print completion code
...
This flag takes as input 'bash' or 'zsh' and generates the completion
code for the specified shell.
2016-07-26 15:32:03 +02:00
Dan Buch
f7b2b93ffa
Merge remote-tracking branch 'origin/v1' into merging-from-v1
2016-07-14 17:50:16 -04:00
Bruno França dos Reis
028af4bc35
adding support for Float64SliceFlag
2016-06-28 19:52:25 -07:00
Dan Buch
6185b8d8fd
Generate code for flag types and context accessors
2016-06-23 00:56:44 -04: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
Dan Buch
537f5beb66
Tweaks to Int64Flag PR
2016-06-16 10:14:28 -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
7cd5bed6cb
Backporting flagValue func from v2 branch
2016-06-08 10:34:44 -04:00
Joshua Rubin
f621deee5a
fix panic getting visible flags
2016-06-08 04:27:57 -06:00
3b03164c92
Merge branch 'v2' into show-bool-default
2016-05-28 04:49:10 -04:00
Dan Buch
cd1e8c3452
Merge remote-tracking branch 'origin/v2' into minimize-struct-copying
2016-05-25 09:35:21 -04:00
Dan Buch
2b288769c7
Add comment about commaWhitespace stripping of flag.Name
2016-05-24 04:00:37 -04:00
c70993dbc5
Merge branch 'v2' into minimize-struct-copying
2016-05-23 22:08:59 -04:00
80f444e0f5
Merge branch 'v2' into clean-stringlies
2016-05-23 22:08:42 -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
ec05a8d31b
Ensure flag "Name" field values are un-stringly-fied
...
to (hopefully) help with bug triage & pinpointing usage issues since ripping out
stringly typed "Name".
2016-05-23 20:55:03 -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
334e66cb8f
Remove unused (so far) func
2016-05-22 10:59:42 -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
f2d5ed9933
Replace BoolTFlag type with BoolFlag.Value
...
Closes #412
2016-05-18 08:20:15 -04:00
Dan Buch
32ebecfbb5
Merge remote-tracking branch 'origin/master' into v2
2016-05-09 11:18:21 -04:00
Matt Farina
07ce8bf79c
Cleaned up else per golint
...
When an if ends in a return the else is not required. golint
detects these conditions and found these.
2016-05-09 10:15:05 -04:00
Matt Farina
2f110bd745
Cleaned up exported func comments per golint
2016-05-09 10:12:59 -04:00
Dan Buch
bac790c819
Merge remote-tracking branch 'origin/master' into v2
2016-05-09 08:00:13 -04:00
Matt Farina
6f0b442222
Update to ErrWriter and make available on app
2016-05-06 12:14:26 -04:00
Matt Farina
2a256d4c53
Provide a variable for writing output with a default of os.Stderr
2016-05-05 10:26:53 -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
cd92adcb75
Further simplifying default flag stringer func
2016-05-02 19:58:16 -04:00
Dan Buch
6089d723a8
Use existing prefixedNames
func
2016-05-02 19:52:39 -04:00
Dan Buch
69a8e25f3d
Make flag usage rendering more consistent; show default values
2016-05-02 19:42:08 -04:00
Dan Buch
23af5dd643
Rename flag stringer func bits for clarity, consistency
2016-05-02 13:07:57 -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
fed78b8bab
Rework of hidden flag impl plus some Action func corrections
2016-05-01 08:36:17 -04:00
Harshavardhana
99431669d0
New `Hide
` variable for all Flags
...
This is a way to provide hidden flags for app, command and subcommands
For example:
--generate-bash-completion global flag shouldn't be printed along
with other flags as it might generally confuse people into thinking
that 'generate' in-fact would generate a bash completion file for them
to be used along with their app.
Also in general one would want to hide some flags for their apps.
2016-04-30 22:24:27 -04:00
Dan Buch
1a91f3dce5
Ensure IntSlice & StringSlice serialization works as expected
2016-04-29 02:53:58 -04:00
Dan Buch
d1b0c49a98
Ensure slice types can safely round-trip through flag.FlagSet
2016-04-29 02:30:49 -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
Kevin Cantwell
13b7eedc13
Parses usage placeholders via back quotes. Resolves #333
2016-04-21 23:04:01 -04:00
Dan Buch
7a5bfc850d
Update dangling IntSlice literal
2016-04-05 22:40:12 -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
adamclerk
cde8418658
Fixes spelling issues and import alphabetical issues
...
Using goreportcard.com I noticed a few spelling errors. I really love codegangsta/cli
and wanted to help improve it.
2016-02-09 09:36:13 -07:00
Gregor Noczinski
09e2c89597
* Changed the way how to return the result. Because of strange ci failure
2016-01-23 12:01:49 +01: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
Jille Timmermans
f101a00018
Export cli.Flag.GetName (previously cli.Flag.getName)
2015-12-15 17:29:03 +00:00
ston1th
25ef368235
added destination scan testing and BoolT
2015-11-14 22:39:38 +01:00
ston1th
bb7e45acf1
Added destination scan support for flags
2015-11-14 20:01:15 +01:00
Jesse Szwedko
005b120d20
Add godoc comments to flag structs
2015-06-02 20:51:09 -07:00
Sergey Romanov
f47f7b7e85
Fix panic if Valus in Int/StringSliceFlasg is missing
2015-06-01 01:50:23 +05:00
jhowarth
a6482d2687
Merge remote-tracking branch 'upstream/master'
...
Conflicts:
app.go
command.go
flag.go
2015-03-02 15:21:01 -08:00
jszwedko
44d40054fa
Use 0 as the base when parsing ints
...
To be consistent with what the stdlib flag package does.
2015-01-09 13:10:42 -05:00
Sam Zaydel
ef23aa6da2
strconv.ParseInt should be used instead of strconv.ParseUint when reading Int Flags from envvars.
2015-01-09 05:53:14 -08: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
21d399c3fa
Merge pull request #166 from codegangsta/fix-generic-flag-help-text
...
Fix help text for generic flag to not insinuate that you can specify mul...
2015-01-08 14:50:16 -05:00
5b9e204508
Merge pull request #153 from codegangsta/allow-hiding-of-help-flag
...
Allow hiding of help flag without hiding help subcommand
2015-01-08 14:49:36 -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
Jesse Howarth and Michael Ivey
73e64a14fd
Add (required) to help of flags that are required.
2014-12-02 21:13:26 +00:00
Jesse Howarth and Michael Ivey
7e05320026
Implement required flags
2014-12-02 17:44:55 +00:00
jszwedko
780f839a02
Allow hiding of help flag without hiding help subcommand
...
By utilizing struct zero value
2014-12-01 23:21:22 -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
fc16c67be3
Updating structs to use labels, adding tests for env stuff
2014-07-11 18:13:10 -04:00
97fd93272f
Starting to hack in some env var configuration goodness
2014-07-11 13:29:56 -04:00
Jeremy Saenz
bb9189510a
Merge pull request #81 from zenoss/upstream/feature/generic-flags
...
Generic parsers as flag types
2014-05-27 16:54:16 -07:00
Summer Mousa
a911ec75e4
Can now change these default flags in other applications
2014-04-29 09:21:19 -05:00
Pekka Enberg
646b290d5d
Make StringSliceFlag usage text consistent
...
This fixes StringSliceFlag default usage text to be consistent with
IntegerSliceFlag.
Before:
-f [] `-f option -f option` port forwarding rules
After:
-f '-f option -f option' port forwarding rules
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2014-04-17 11:44:12 +03: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
Jeremy Saenz
640826c88f
Merge pull request #78 from zenoss/feature/bash-completion
...
Bash completion
2014-04-14 10:00:36 -07:00
Summer Mousa
3a10545f91
Made bash completion command optional; still need to update documentation
2014-04-12 08:32:53 -05:00
Ryan Schmukler
312151dca4
remove quotes for empty StringFlags
2014-04-11 15:16:09 -04:00
Yicheng Qin
5903a0a844
Add BoolTFlag type
...
Compared to BoolFlag type, BoolTFlag treats 'true' as the default value
for the flag.
Without it, we have to use --no-action flag if we set the action is done
in default. But sometimes it is bad to maintain flags with negative meanings.
And it will be painful if we change the default value for the flag.
As this implementation, it keeps all existing functionality. So it
is compatible with old versions.
2014-03-05 17:24:22 -08:00
Katrina Owen
dde48a57c9
Standardize import statements
2013-12-07 07:10:04 -08:00
Katrina Owen
2ec51afe91
Implement Float64Flag. See #46
2013-12-03 05:42:26 -08:00
Ryan S. Brown
28cf49a4ca
string slice flag option formatting
...
Used to output:
```
-- 'name' -name option -name option%!(EXTRA string=Usage text)
```
Now:
```
--name [] `-name option -name option` Usage text
```
2013-12-02 13:29:43 -06:00
Jeremy Saenz
ab6f1b7c3c
Formatting
2013-11-20 17:25:13 -08:00
Jeremy Saenz
4120b604ec
Removed help flag. we no longer need it.
2013-11-20 17:24:37 -08:00
Jared Forsyth
dc8a62e0e9
refactor, more robust flag propagation
2013-11-20 01:05:18 -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
Thesyncim
ed96efff1b
add simple test , fix errors and unused interface SliceFlag
2013-09-24 20:36:01 +01:00
Thesyncim
4d9038a156
add ability to parse []string types
2013-09-24 02:41:31 +01:00
Mike Gehard
1a1d6bd163
Vary flag prefix based on name length
2013-09-09 11:52:12 -07:00
Mike Gehard
7ec896dde0
Update flag.go
...
Make boolean flags more in line with standard UNIX boolean flags.
2013-09-09 11:52:12 -07:00
Jeremy Saenz
70eacca641
JMS #25 : Added support for help flags
2013-07-24 07:35:45 -07:00
Jeremy Saenz
04490dabec
Minor tweaks and cleanup
2013-07-20 08:21:20 -07:00
Jeremy Saenz
6664835bc1
JMS #14 : Moving toward having and app object
2013-07-19 08:34:01 -07:00
Jeremy Saenz
3119b075d6
JMS #4 : Flag testing
2013-07-18 17:41:22 -07:00
Jeremy Saenz
3f76896c4f
JMS #4 : Getting some cli tests going. Testing out flags
2013-07-18 17:41:22 -07:00
Jeremy Saenz
04496e4364
JMS #4 : More WIP
2013-07-18 17:41:22 -07:00