Commit Graph

950 Commits

Author SHA1 Message Date
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
Anthony Fok 750ba8ac93 Fix reproducibility in TestGolden{Add,Init}Cmd
These tests were time-dependent and would start failing in 2018
when the golden files still have the copyright year of 2017.

Fix by hard-coding the year 2017 for the purpose of these two tests
to ensure reproducible builds.

Fixes #503
2017-07-30 00:17:45 -06:00
Anthony Fok 161584fc2e Fix minor typos: "Know" → "Known" 2017-07-29 22:49:33 -06:00
Anthony Fok 34594c771f Fix TestGlobalNormFuncPropagation() on gccgo
According to golang/go#9504 and https://golang.org/pkg/reflect/#Value,
== should not be used on two reflect.Values, but comparing the results
of their Interface() method does not work in this case, so let's
compare the results of their Pointer() method instead.

See https://stackoverflow.com/questions/9643205/how-do-i-compare-two-functions-for-pointer-equality-in-the-latest-go-weekly
2017-07-25 14:04:38 +02:00
Albert Nigmatzianov 90fc11bbc0 Update README.md 2017-07-24 09:18:37 +02:00
Daniel Nephin f20b4e9c32 Refactor TakesArgs to use an interface for arg validation.
Fix some typos in README and comments.
Move arg validation to after flag validation so that the help flag is run first.
Pass the same args to ValidateArgs as the Run methods receive.
Update README.

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-07-23 09:57:27 +02:00
Eric Paris d89c499964 Allow commands to explicitly state if they do, or do not take arbitrary arguments
Check that arguments are in ValidArgs

If a command defined cmd.ValidArgs check that the argument is actually
in ValidArgs and fail if it is not.
2017-07-23 09:57:27 +02:00
Albert Nigmatzianov 715f41bd7a cmd: Ignore hidden files in isEmpty 2017-07-18 18:22:37 +02:00
Albert Nigmatzianov d994347eda Delete tab in the long description of help 2017-07-16 12:48:02 +02:00
Albert Nigmatzianov c46add8a65 Add ability to disable mousetrap
Fix #486
Close #383 (no progress there)
2017-07-11 14:08:33 +02:00