Commit Graph

839 Commits

Author SHA1 Message Date
Nikola Kovacs 24bb44aac8 Fix SilenceUsage and SilenceErrors in readme (#397)
You have to set them to true to silence the default output, not false.
2017-03-08 14:37:25 -05:00
Albert Nigmatzianov fcd0c5a1df Some fixes related to help command (#394)
* Add dots in the end of docs

* Make UsageTemplate show help command

Fix #366

* Fix output of help if it's invalid command
2017-02-28 14:17:48 -05:00
Eric Paris 92ea23a837 Fix subcommand locations with NoOptDefValue flags (#391)
If one ran a command like

./root --boolFlag subcmd1 subcmd2

Thing worked fine. The code recognized that --boolFlag followed by a
space meant the next word was not the argument to --boolFlag. But other
flag types with a NoOptDefValue (like a Count flag) would not ignore the
"argument".  On a command like:

./root --countflag subcmd1 subcmd2

The processor, when looking for a subcommand, would first throw out the
`--countflag subcmd1` and then look for subcmd2 under root.

The fix is to ignore the next word after any NoOptDefVal flag, not just
boolean flags.
2017-02-23 08:12:51 -05:00
Bjørn Erik Pedersen ee4055870c Update the Travis Go versions 2017-02-17 17:45:07 +01:00
Di Xu b5d8e8f46a cache command name (#390) 2017-02-09 11:54:17 -05:00
Daniel Nephin 99600f6874 Add a tags field for user defined tags on a Command. (#359)
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-02-07 16:20:48 -05:00
French Ben 35136c09d8 Added support for yaml ouptut in docs gen (#380)
Signed-off-by: French Ben <frenchben@docker.com>
2017-01-30 16:45:31 -05:00
Vincent Batts c29ece4386 Go vet (#345)
* bash_completions: cleanup for go vet

The gnarly block of string in the Fprint tripped up go vet and was not
easy to read.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>

* test: cleanup for go vet

Looks like copy'pasta and an unused variable

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2017-01-26 14:32:19 -05:00
Oleg Atamanenko 0f056af21f Added godocs to public methods. (#386)
* Added godocs to public methods.

* Fix gofmt formatting.
2017-01-24 11:30:45 -05:00
Apurva Chitnis dc208f4211 Added useful info for setting up bash autocompletion. (#384) 2017-01-18 13:55:16 -05:00
Raphael 'kena' Poss 1dd5ff2e11 Make SEE ALSO references and generated file names agree with each other. 2016-12-29 00:59:22 -07:00
Philipp Muens de09d9ce07 Update README with missing import statements (#373) 2016-12-22 10:12:50 -05:00
Qinglan Peng b62566898a fmt package should be imported (#370)
Signed-off-by: Qinglan Peng <qinglanpeng@zju.edu.cn>
2016-12-14 10:19:52 -05:00
Yuanxiao 9495bc009a echo msg not echo msg msg (#364) 2016-11-16 08:20:53 -05:00
Julien Kassar 6b74a60562 Update doc/man_docs.md (#363) 2016-11-15 09:16:05 -05:00
Ben Gadbois 6e91dded25 Make gofmt -s pass (#355) 2016-10-25 18:28:26 -07:00
Eric Paris 856b96dcb4 Merge pull request #353 from bogem/helpfunc
Fix condition in HelpFunc
2016-10-14 18:20:36 -04:00
bogem 011f19e8ec Fix condition in HelpFunc
I think, it's more obvious, what does this method
2016-10-14 20:34:35 +02: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
Eric Paris b620a7591d Merge pull request #283 from dnephin/add_flag_usage_func
Add support for setting a function to handle flag parsing errors
2016-10-10 11:13:51 -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
Eric Paris 9c28e4bbd7 Merge pull request #339 from bogem/fixes
Some fixes
2016-08-30 13:49:25 -04:00
bogem 5da98880f3 Edit documentation 2016-08-30 22:14:27 +05:00
bogem 101d434d44 Simplify OnInitialize func 2016-08-30 21:58:52 +05:00
bogem 71a9c0834b Simplify condition with err 2016-08-30 21:57:12 +05:00
Eric Paris d671d98363 Merge pull request #338 from icaoweiwei/patch-2016-08-29-2
Fix typo
2016-08-30 11:26:59 -04:00
Cao Weiwei 4a087062c6 Fix typo
Signed-off-by: Cao Weiwei <cao.weiwei30@zte.com.cn>
2016-08-29 00:18:06 +08:00
Eric Paris 37c3f80603 Merge pull request #332 from broady/master
travis: fix build matrix config
2016-08-23 17:51:50 -04:00
Chris Broadfoot ed0a8cae34 travis: fix build matrix config 2016-08-23 13:41:01 -07:00
Eric Paris 8e9c5e77eb Merge pull request #331 from broady/fmtetc
gofmt, govet, run those in Travis
2016-08-23 16:37:01 -04:00
Chris Broadfoot d1371ecdb4 gofmt, govet, run those in Travis, add 1.7 2016-08-23 13:30:43 -07:00
Eric Paris 1f4717172e Merge pull request #327 from bogem/fixes
Some small fixes
2016-08-22 09:59:44 -04:00
bogem 6e17f4e2c5 Fix typos 2016-08-20 12:04:53 +05:00
bogem ec452170d2 Fix error messages in cobra_test 2016-08-20 12:02:26 +05:00
Eric Paris 7c674d9e72 Merge pull request #313 from euank/swift-as-a-cobra-hidden-as-a-ninja
Display neither hidden nor deprecated flags in bash completion
2016-08-02 18:37:37 -04:00
Euan Kemp 40e19b3f3b Don't display deprecated flags in bash completions 2016-08-02 15:01:33 -07:00
Euan Kemp 75daccd5b8 Don't display hidden flags in bash completions 2016-08-02 14:49:33 -07:00
Eric Paris f62e98d28a Merge pull request #300 from cshung/master
Include instruction for building the cobra tool in README.md
2016-07-22 04:15:47 -04:00
Eric Paris dbb7c2d02e Merge pull request #308 from fabianofranz/restore_backwards_compatibility
Restore Help() and Usage() for backwards compatibility
2016-07-20 22:00:57 -04:00
Fabiano Franz ded646f978 Restore Help() and Usage() for backwards compatibility 2016-07-20 12:02:56 -03:00
Bjørn Erik Pedersen 9d9ce1213e Bump Travis to Go 1.6.3 2016-07-18 23:49:35 +02:00
Eric Paris b24564e919 Merge pull request #305 from fabianofranz/expose_out
Fixes how we expose help and usage and expose output without making assumptions
2016-07-15 19:55:49 -04:00
Fabiano Franz d6bf4ef243 Don't expose Usage() and Help() - our interfaces are UsageFunc, HelpFunc and UsageString 2016-07-15 17:18:59 -03:00
Fabiano Franz 20217d8f5e Expose OutOrStdout and OutOrStderr and don't make assumptions if output is not set 2016-07-15 17:18:47 -03:00
Eric Paris a272c3cbd5 Merge pull request #303 from fabianofranz/testing_help_exiting_1
Help command must use Stdout instead of Stderr
2016-07-08 16:24:02 -04:00
Fabiano Franz 77530f537e Help command must use Stdout instead of Stderr 2016-07-06 12:51:57 -03:00
Andrew Au cb51c97a4e Include instruction for building the cobra tool in README.md 2016-06-29 21:34:17 -07:00
Eric Paris 6a8bd97bdb Merge pull request #294 from dnephin/fix_man_page_gen_bugs
Fix man page gen bugs
2016-06-21 16:47:55 -04:00
Daniel Nephin e291587027 Cretea a new GenManTree function that takes an options struct.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2016-06-21 14:47:14 -04:00
Daniel Nephin 97206b3170 Use the correct man page section for the filename
Also make header mutation cleaner.

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2016-06-21 14:30:54 -04:00