Commit Graph

582 Commits

Author SHA1 Message Date
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
Albert Nigmatzianov 8c6fa02d22 Fix InitDefaultHelpCmd when custom help command is set 2017-06-29 12:52:34 +02:00
Johanan Liebermann 4d647c8944 Print err instead of home
When 'home' can't be determined it doesn't make sense to print it.
The value of 'err' should be printed instead.
2017-06-24 17:01:00 +02:00
Johanan Liebermann 6471e3de04 Rename main func to initConfig
The function called `main` in the manual creation example should be called
`initConfig`.
2017-06-24 16:56:34 +02:00
Johanan Liebermann f9d34972c1 Fix RootCmd var name
'rootCmd' should be 'RootCmd'.
2017-06-24 16:56:22 +02:00
Johanan Lieberman d638dcb7c7 Improve readability of README
Improve punctuation, fix capitalization in a couple of places and
rephrase some sentences for better readability.
2017-06-23 19:56:08 +02:00
Brian Danowski e458bb7ab8 Reword `become unexpected errors` to `encounter errors` 2017-06-23 16:17:13 +02:00
Johanan Liebermann 31694f19ad Add missing 'and' in comment 2017-06-21 19:32:59 +02:00
Albert Nigmatzianov 99b5d838ca Show messages if deprecated flags are used
Fix #463
2017-06-19 23:05:29 +02:00
Albert Nigmatzianov b4dbd37a01 cmd: Fix tests 2017-06-12 08:36:10 +02:00
Albert Nigmatzianov defa97f560 cmd: Fix output root.go of init with --viper=false
Fix #462
2017-06-12 08:23:33 +02:00
Albert Nigmatzianov d7cfb13474 Update README.md 2017-06-09 21:55:21 +02:00
Albert Nigmatzianov 99ff9334bd cmd: Add possibility to specify the target package
Fix #455
2017-06-07 08:07:48 +02:00
Albert Nigmatzianov 84f471618b Make BenchmarkBashCompletion more honest
name              old time/op    new time/op    delta
BashCompletion-4    67.4µs ± 1%    50.8µs ± 3%  -24.63%  (p=0.000 n=17+19)

name              old alloc/op   new alloc/op   delta
BashCompletion-4    29.5kB ± 0%    29.5kB ± 0%   +0.00%  (p=0.020 n=20+20)

name              old allocs/op  new allocs/op  delta
BashCompletion-4       253 ± 0%       253 ± 0%     ~     (all equal)
2017-06-05 19:32:33 +02:00
Lucy Davies 66da711334 __ltrim_colon_completions is not always available on macOS (#459)
* __ltrim_colon_completions is not always available on macOS, so bash-completion should check first
2017-06-05 11:18:07 -04:00
Martin Marcher 8d4ce3549a Update README.md
Fix description to actually install generator as well as latest version of the library
2017-05-31 06:54:52 +02:00
Albert Nigmatzianov e606913c4e Fix typos 2017-05-28 12:56:30 +02:00
Albert Nigmatzianov 4a1a7b086e cmd: Don't print errors from execute to prevent duplication of errors 2017-05-28 12:26:28 +02:00
Albert Nigmatzianov c446db21d3 cmd: Delete projectBase flag
It's redundant and it didn't work earlier anyway.
2017-05-28 12:25:51 +02:00