Commit Graph

11 Commits

Author SHA1 Message Date
Ben Gadbois 6e91dded25 Make gofmt -s pass (#355) 2016-10-25 18:28:26 -07:00
Eric Paris ec2fe78599 Merge pull request #286 from dnephin/merge_flags_before_adding_help
Merge persistent flags before checking for a help flag
2016-10-10 11:14:18 -04:00
Daniel Nephin 67feb8173c Add support for setting a function to handle flag parsing errors.
The default pflag error is to only print the bad flag. This enables an application
to include a usage message or other details about the error.

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2016-10-10 10:56:48 -04:00
Chris Broadfoot d1371ecdb4 gofmt, govet, run those in Travis, add 1.7 2016-08-23 13:30:43 -07:00
Daniel Nephin 7faa7fcdd2 Merge persistent flags before checking for a help flag.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2016-06-20 14:58:44 -04:00
Andrey Kurilin ab97c7a63a Sort commands by their names
The slice of commands are sorted now automatically while Commands are called.
To turn off this feature, EnableCommandSorting variable is added.
2016-06-15 17:27:34 +03:00
Mark Bates dc6e9ece6f added a flag to disable flags 2016-06-03 20:25:52 -04:00
Steve Domino 6d2f1d2fa7 Ability to hide commands from usage/help text
Added the ability to have hidden commands that cobra will still run as intended, however they won't show up in any usage/help text

adding internal field to command

private is a better name

hiding private commands in default help/usage

opting for 'hidden' over 'private'

updating all 'help command' checks to exclude hidden commands

updating how commands are displayed in usage/help text by updating/adding some methods. added tests for hidden/deprecated commands

making command hidden when testing hidden command execution

test now leverage the included suite and are much less custom. also removed deprecation tests, once I discovered them in cobra_test.go

updating hidden command test to be more reliable

removing unnecessary () when checking len(c.Deprecated)

updating command comments to be godoc friendly
2015-09-08 17:01:13 -06:00
Jeff Lowdermilk 79bd93d369 Add test for persistent bool flag on subcommand 2015-03-23 14:42:59 -07:00
Brendan Burns 93278e2f35 Add mergePersistentFlags in strip flags since we now look at the flag set. 2015-03-16 16:15:32 -07:00
Brendan Burns bbdea35c49 Fix stripFlags to be more intelligent about what it parses. 2015-03-12 22:36:49 -04:00