Commit Graph

950 Commits

Author SHA1 Message Date
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
Albert Nigmatzianov
7918bf6886 Add explanation for viper.BindPflag in README.md
Fix #429

/cc @deltaskelta
2017-05-28 09:16:21 +02:00
Albert Nigmatzianov
ca57f0f5db doc: Ad help flag and cmd when generating docs 2017-05-20 19:28:06 +02:00
Albert Nigmatzianov
52ae6a1d02 Make initHelpCmd public (#436)
Useful for solving #424
2017-05-20 19:23:33 +02:00
Albert Nigmatzianov
ca5710c94e Fix link to cobra lib in README.md 2017-05-19 22:27:40 +02:00
Robert Anthony Bellamy
4ba54a0f7f Edit installation command in README.md (#451) 2017-05-19 21:09:26 +02:00
Albert Nigmatzianov
fb1f39915d Add benchmark for GenBashCompletion 2017-05-18 15:03:00 +02:00
Albert Nigmatzianov
de6b168d98 Simplify bash_completions.go
Improve test coverage from 80% to 85%.
2017-05-18 15:03:00 +02:00
Albert Nigmatzianov
4cdb38c072 cmd: Use correct HasPrefix function for paths
Updates #448
2017-05-15 09:51:20 +02:00
Albert Nigmatzianov
e9078fccb8 cmd: Make more accurate error when there is no $GOPATH 2017-05-15 09:20:36 +02:00
Albert Nigmatzianov
fa9ac853ce cmd: Make detailed error when project not in $GOPATH
Updates #448
2017-05-15 08:37:15 +02:00
Albert Nigmatzianov
51b7cf57e1 Fix tests so they give correct args (#445)
* Fix tests so they give correct args

Shell already deletes all quotes and unite args under quotes, so we
don't need to test it.

* Simplify stripFlags

* Fix 'unused' and 'gosimple' complaints
2017-05-14 08:51:04 -04:00
Albert Nigmatzianov
b5366273a6 cmd: Fix some gometalinter complaints 2017-05-14 12:27:15 +02:00
Albert Nigmatzianov
d9414968f8 cmd: Fix error message from go-homedir 2017-05-14 12:03:16 +02:00
Behrang Noruzi Niya
a28055bed2 cmd: Fix minor bugs in init command (#446) 2017-05-14 12:00:53 +02:00
Don Petersen
90687e7bfc Update pflag link in README (#444)
Cobra is not using ogier/pflag, but a fork of it.
2017-05-12 20:40:24 +02:00
Albert Nigmatzianov
7d22e77cce Fix incorrect merge of pflag.CommandLine to cmd.Flags()
Fix #443
2017-05-12 20:22:26 +02:00
Albert Nigmatzianov
3454e0e28e cmd: Fix package name when adding command 2017-05-12 12:10:33 +02:00
G. Hussain Chinoy
4673102358 Updating bash_completions to clarify markdown (#442)
"Plural form and shortcuts for nouns" section had a stray backtick, making Markdown rendering for code examples strange. Removed said backtick.
2017-05-11 17:04:35 +02:00
Albert Nigmatzianov
1362f95a8d Clean README.md (#441)
The release notes are obsolete and we better have a release notes
in Github releases

We don't need this TODO as we have godoc

And bitdeli doesn't work and doesn't supported for about 3 years.
2017-05-09 16:18:58 -04:00
Eric Paris
347767f8bd Partial revert of 4d2c4af 'Improve template mechanism' (#439)
There were template functions which we defined and others started using.
Although we no longer want those functions, since others use them,
deleting them breaks our API.  Putting those (unused) functions back.
2017-05-09 15:07:05 -04:00
Albert Nigmatzianov
eceb483eb5 Divide fields of Command for readability 2017-05-09 11:33:56 +02:00
Albert Nigmatzianov
90d2fd84ad Group fields of Command 2017-05-09 11:25:41 +02:00
Albert Nigmatzianov
1251aefb74 Rename Docker to Moby in README.md 2017-05-09 11:19:15 +02:00
Albert Nigmatzianov
e97db2b866 cmd: Fix tests 2017-05-09 11:15:48 +02:00
Albert Nigmatzianov
4db577d34d Fix docs for Command 2017-05-09 11:15:05 +02:00
Albert Nigmatzianov
6bfe2ba1a2 doc: Add docs 2017-05-09 11:14:48 +02:00
Albert Nigmatzianov
3dc7f13b65 cmd: Fix docs 2017-05-09 11:14:33 +02:00
Albert Nigmatzianov
d236d29810 cmd: Make tmpl local variable
Fix CircleCI tests
2017-05-08 23:00:14 +02:00
Adrián López
c0bd07d7ba Use cobra create instead of cobra init in README.md (#396) 2017-05-08 14:23:08 +02:00
Albert Nigmatzianov
4d2c4afa04 Improve template mechanisms
* Delete Eq, Gt, appendIfNotPresent and trim functions

* Add "[flags]" in UseLine

* Simplify other functions

* Simplify templates

Minor performance improvement.
Benchmark for command with 4 flags and one child command:
benchmark                   old ns/op     new ns/op     delta
BenchmarkCmdUsageFunc-4     335860        319290        -4.93%

benchmark                   old allocs     new allocs     delta
BenchmarkCmdUsageFunc-4     562            543            -3.38%

benchmark                   old bytes     new bytes     delta
BenchmarkCmdUsageFunc-4     21623         21037         -2.71%
2017-05-08 14:22:04 +02:00
Albert Nigmatzianov
d83a1d7ccd Add comment for InitDefaultHelpFlag 2017-05-07 10:52:40 +02:00
Albert Nigmatzianov
fe69f2e3a3 Make initHelpFlag public
Used for solving #424
2017-05-07 00:45:39 +02:00