Commit graph

909 commits

Author SHA1 Message Date
Nick Miyake
ccaecb155a Ensure that '--version' flag works properly for root command (#595)
Make it so that, in the case that the root command is not runnable
but has subcommands, specifying a '--version' flag will still
run the "version" behavior.
2017-12-07 08:49:35 +01:00
Jonathan Hall
c156af3984 Explain OnInitialize better in the GoDoc (#594) 2017-12-06 19:18:45 +01:00
Allen Sun
de2d9c4eca Add alibaba/pouch in README.md (#593)
Signed-off-by: Allen Sun <shlallen1990@gmail.com>
2017-12-04 14:13:25 +01:00
Allen Sun
3a5f27b046 doc: Add a necessary blank line after SEE ALSO (#592)
Signed-off-by: Allen Sun <shlallen1990@gmail.com>
2017-12-04 11:43:02 +01:00
Allen Sun
45a52e208c doc: Remove one additional blank line after Synopsis (#591)
Signed-off-by: Allen Sun <shlallen1990@gmail.com>
2017-12-04 10:21:50 +01:00
Nick Miyake
86783686ca Add documentation for '--version' flag to README (#590) 2017-12-02 18:59:49 +01:00
Nick Miyake
b1ec2ce1ad Add support for --version flag (#584) 2017-12-01 22:37:16 +01:00
Nick Miyake
1be1d2841c Make rootCmd private
Update Cobra generator to make rootCmd private rather than
exporting it. Also update examples in README to use the exported
Execute() command rather than referencing unexported rootCmd.

Fixes #556
2017-11-23 08:13:30 +01:00
Nick Miyake
fb02817f3c Fix README example to be consistent with others (#585)
Alphabetize and separate builtin imports from external imports
to be gofmt-compliant and consistent with other examples in README.
2017-11-22 16:30:46 -05:00
Nick Miyake
19e54c4a2b Update error message for missing required flags (#580)
Make it so that first letter is not capitalized and rephrase
to remove "have/has".
2017-11-19 10:22:51 +01:00
Daniel Nephin
34ceca591b Disable flags in UseLine (#552)
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-11-19 08:58:54 +01:00
Tyler Butler
d6948b782c Fix minor typo (#579) 2017-11-17 00:24:59 -05:00
Albert Nigmatzianov
2da4a54c5c Improve tests in doc/ 2017-11-09 07:56:43 +01:00
Albert Nigmatzianov
d6a430541c Edit ResetFlags and ResetCommands descriptions 2017-11-09 07:56:43 +01:00
Albert Nigmatzianov
65c8acb228 Improve tests 2017-11-09 07:56:43 +01:00
Albert Nigmatzianov
099c5aef9e Add dots in comments of args.go 2017-11-09 07:56:43 +01:00
Albert Nigmatzianov
18eefcde17 Add tests for args.go 2017-11-09 07:56:43 +01:00
Pavol Loffay
f634327172 Fix typo (#573) 2017-11-08 11:47:54 +01:00
Paweł Słomka
b3426bbac1 Remove confusing duplicate Execute from README (#554) 2017-10-29 22:09:45 +01:00
Thomas Cyron
7b2c5ac9fc Create new buffer if not present yet (#549)
Fixes a nil dereference when TraverseChildren is used
with multiple subcommands.
2017-10-12 20:25:33 +02:00
Di Xu
7cd9cc6d44 add test for c.Name() if c.Use gets changed (#548) 2017-10-12 12:50:22 -04:00
Albert Nigmatzianov
40f18800b2 Delete name field from Command (#547)
Discussion: https://github.com/spf13/cobra/pull/422#discussion_r143918343
2017-10-11 10:15:37 -04:00
Kazuki Suda
845c905010 Fix typo 2017-10-11 06:52:18 +02:00
Di Xu
4d6af280c7 enforce required flags (#502) 2017-10-09 23:44:33 -04:00
Clayton Ray
50204810fd Grammar addition (#543)
Just added a comma. Read weird without it
2017-10-09 08:28:07 +02:00
Daniel Nephin
83b1f03962 Add a TraverseChildren option to allow for flags on each command in the hierarchy (#299)
Fix #277 
Fix #467
2017-10-07 23:29:11 +02:00
Shahidh K Muhammed
419e0f8d51 doc: add ReST doc generation (#537) 2017-10-07 19:39:47 +02:00
Albert Nigmatzianov
bc69223348 Fix dead link in README for cobra generator
Fix #542
2017-10-06 21:18:12 +02:00
Albert Nigmatzianov
e8e7fe0355 Shorten README
Fix #501
2017-10-06 12:20:24 +02:00
Albert Nigmatzianov
d5bde60e02 cmd: Fix text of custom license
Fix #540
2017-10-04 22:36:42 +02:00
Diego Becciolini
0dacccfbaa Improve consistency of flags when using SetGlobalNormalizationFunc (#522)
Fix #521
2017-10-02 12:00:25 +02:00
Elliott Beach
e5f66de850 Support default value of $GOPATH (#532)
Add support for go1.8 of blank $GOPATH
2017-09-29 18:16:12 +02:00
Eric Paris
b787445794 Use func (c *Command) consistently (#530)
It makes the docs looks better. The idea was suggested by @SamWhited
2017-09-05 13:20:51 -04:00
agmen
4de692c1eb adding a GenZshCompletionFile function to mirror bash_completion (#529) 2017-09-05 12:32:32 -04:00
Edward Betts
3c0b56b677 correct spelling mistake (#524) 2017-09-01 11:16:37 -04:00
Albert Nigmatzianov
2df9a53181 Fix MinimumArgs 2017-08-23 12:32:09 +05:00
Albert Nigmatzianov
cb747385b3 Retab README.md 2017-08-23 12:32:09 +05:00
Albert Nigmatzianov
1723331773 Update documentation 2017-08-23 12:32:09 +05:00
Albert Nigmatzianov
8bcacfe133 Add more examples of Args field 2017-08-23 12:32:09 +05:00
joelterry
4a7b7e6586 *following 2017-08-20 07:33:59 +05:00
Tom Elliott
cb731b8983 Specify that parent's name is a variable for clarity. #514 2017-08-15 11:22:12 +05:00
Anthony Fok
b26b538f69 Fix remaining reproducibility in TestGoldenAddCmd
My previous fix in PR #504 was incomplete.

Fixes #503
2017-07-31 11:04:27 -06:00
Albert Nigmatzianov
3da102d464 cmd: Fix golden tests if user has config at $HOME
Fix #505
2017-07-31 06:38:19 -06:00
Albert Nigmatzianov
99838a52fe cmd: Small fixes 2017-07-31 06:38:19 -06:00
bpicode
d7ba19510d Add basic zsh completion (command hierarchy only)
Partially fixes #107
See PR #497
2017-07-30 02:44:28 -06:00
Anthony Fok
9e024b655b cmd: Refine formatting of included licenses 2017-07-30 02:35:06 -06:00
Anthony Fok
a1b7d3cc4d cmd: Add a blank line between copyright and license 2017-07-30 02:15:55 -06:00
Anthony Fok
75c6acfc8f cmd: Add "-u" to output unified diff in golden tests 2017-07-30 02:11:56 -06:00
Anthony Fok
cb9cf94690 Restore the use of cobra.OnInitialize in cobra executable
Without cobra.OnInitialize, cobra does not see the --config
command-line option and always tries to load $HOME/.cobra.yaml
instead.
2017-07-30 01:19:17 -06:00
Anthony Fok
d4c40bbacf travis: Update Go versions 2017-07-30 00:20:54 -06:00