Commit graph

739 commits

Author SHA1 Message Date
PapaCharlie
53e4e28648 Remove extra splat for zsh arrays
It turns out that zsh will simply use the elements of an array as the parameters when referenced in
the shell without quotes
```
% cat t.py
import sys
print sys.argv

% typeset -a args
% args+=("./t.py")
% args+=("123
321")
% $args
['./t.py', '123\n321']
```
2020-02-21 10:14:45 -08:00
PapaCharlie
979059b9c4 Implement bash completions! 2020-02-21 10:14:45 -08:00
PapaCharlie
684fd47788 Fix broken test
The breakage was caused by the change at line 336, which changed the completion from
```
--option[Help message]:
```
to
```
--option[Help message]:option
```
Semantically this does not change the behavior of the completion, but it does tell zsh to tell you
which flag it is currently completing
2020-02-21 10:14:45 -08:00
PapaCharlie
c87d78cfc6 Add framework for dynamic tab completions
By setting the COBRA_FLAG_COMPLETION environment variable, the normal execution path of the command
is short circuited, and instead the function registered by `MarkCustomFlagCompletion` is executed.

All flags other than the one being completed get parsed according to whatever type they are defined
as, but the flag being completed is parsed as a raw string and passed into the custom compeltion.
2020-02-21 10:14:45 -08:00
Joshua Harshman
39cf99f556
leverage makefile to run build tasks (#976)
remove circle ci
2020-02-20 12:25:38 -07:00
Daniel Esponda
3c2624538b
Correct documentation for InOrStdin (#929)
Documentation on function is incorrect
2020-02-20 11:42:29 -07:00
Alexandr Burdiyan
0da0687426
Add support for context.Context 2020-02-20 07:29:50 +01:00
Andrea Falzetti
21cab29ef9
fix: undefined er (#1039) 2020-02-19 11:20:06 -05:00
Nickolas Kraus
89c7ffb512 Bump year on golden files (#1010) 2020-01-06 11:10:57 -07:00
Marc Khouzam
bf26895664 Fix regression when calling *_custom_func (#1001)
PR #889 introduced a regression where the global variable $c is no
longer set when *custom_func is called.  This is because $c is re-used
by mistake in the read loop.

This PR simply changes the name of the variable used in the loop.

Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
2019-12-26 10:55:42 -07:00
Joshua Harshman
447f182a9d
format tpl/main.go templates (#980) 2019-12-23 13:51:40 -07:00
Marc Khouzam
0d9d2d46f3 Revert change so help is printed on stdout again (#1004)
Fixes #1002
For backwards compatibility reasons, and to follow the need of
https://github.com/kubernetes/kubernetes/pull/26077#issuecomment-230818900
the help message should be printed on stdout.

Signed-off-by: Marc Khouzam <marc.khouzam@gmail.com>
2019-12-23 13:38:24 -05:00
Stefano Guerrini
b04b5bfc50 substitute wrong word in md_docs (#998) 2019-12-02 08:04:30 -05:00
Peter Fern
77e4d5aecc Update md2man to v2.0.0 (#977)
Fixes #805
2019-10-19 16:17:41 -06:00
umarcor
8a4b46fadf update viper to v1.4.0 (#953) 2019-10-13 21:11:37 -06:00
XuZvvHYmZfYdWJNRunkJ
c022f6fabd Update README.md (#944)
I think it meant to be `Echo` here instead of `Print` since the command is called `cmdEcho`.
2019-10-07 15:41:51 -06:00
Joshua Harshman
48e6ac4718
update doc w/ newer cmd/root.go example (#973) 2019-10-07 15:31:10 -06:00
Joshua Harshman
3745fcd262
add goreportcard to readme (#971) 2019-10-03 15:53:10 -06:00
umarcor
19cf35ea77 fix: ensure that testproject is removed even after a failure (#948)
* fix: ensure that testproject is removed even after a failure

* fix: defer licenseFile

* style: simply defer os.RemoveAll

* cobra/cmd: add getProject test func
2019-09-17 09:02:42 -06:00
Christian Muehlhaeuser
606aa5792c Used goimports to fix import order (#912)
Keeps the list sorted and prevents future merge conflicts.
2019-09-16 20:17:19 -06:00
umarcor
4f2877d412 clean(travis): remove shellcheck from before_install (#947) 2019-09-16 20:08:40 -06:00
Gregoire Mahe
b80588d523 fix undefined cfgFile in documentation (#924) 2019-08-05 09:56:17 -06:00
Bruce Downs
993cc5372a Adjustments per PR review feedback from @bogem 2019-08-02 01:25:21 +05:00
Bruce Downs
d85196337c Correct all complaints from goimports
* i.e.
* go get golang.org/x/tools/cmd/goimports
* goimports -w *.go
* goimports -w cobra/
2019-08-02 01:25:21 +05:00
Bruce Downs
51f06c7dd1 Correct all complaints from golint
* i.e.
* go get golang.org/x/lint/golint
* go list ./... | xargs golint
2019-08-02 01:25:21 +05:00
Bruce Downs
9334a46bd6 Return an error in the case of unrunnable subcommand
* credit to @chriswhelix for initial commit
2019-08-02 01:25:21 +05:00
Bruce Downs
9552679939 Add idiomatic handling of go error in distinct main func 2019-08-02 01:25:21 +05:00
Bruce Downs
af29f95b81 Add ignore of cobra posix binary and all of intellij generated files 2019-08-02 01:25:21 +05:00
Joshua Harshman
1c9c46d5c1
Update Generator Docs to reflect changes brought in #817 (#904) 2019-07-24 10:10:51 -06:00
umarcor
2d7544ebde fix missing newline in cmd/add (#905) 2019-07-15 09:44:15 -06:00
Carol A. Scott
9a31ddff0e Add Linkerd to list of projects using Cobra (#892) 2019-07-12 09:55:10 -06:00
rsteube
21f39ca07e bash: fix shellcheck errors (#889)
https://github.com/koalaman/shellcheck/wiki/SC2207
https://github.com/koalaman/shellcheck/wiki/SC2164
2019-07-11 12:18:47 -06:00
Juan Leni
f2b07da1e2 fixing linter issues 2019-06-07 10:48:23 -04:00
Juan Leni
b635726081 considering stderr in UsageString 2019-06-07 10:48:23 -04:00
Alessio Treglia
e35034f0da Add tests 2019-06-07 10:48:23 -04:00
Juan Leni
cb27ce11fb Deprecate and maintain backwards compatibility 2019-06-07 10:48:23 -04:00
Juan Leni
618bc00f80 Allow for explicit output to err/stderr 2019-06-07 10:48:23 -04:00
Juan Leni
0ea93dd60d Fixed linter issues 2019-06-07 10:48:23 -04:00
Juan Leni
4a716d101b Extending redirection to stdout, stderr, stdin 2019-06-07 10:48:23 -04:00
Go Frendi Gunawan
5f23f55c81 Update README.md
To avoid confusion, it is better to use `localCmd` instead of `rootCmd`
2019-06-07 10:47:24 -04:00
ialidzhikov
9eb9f5c66b Add gardenctl to projects build using Cobra
Signed-off-by: ialidzhikov <i.alidjikov@gmail.com>
2019-06-07 10:33:55 -04:00
Joshua Harshman
2411ac592a remove unused struct fields 2019-06-07 10:31:03 -04:00
jharshman
984374f5b6 clean up testproject files after test executes 2019-06-07 10:31:03 -04:00
jharshman
11aa612384 test add 2019-06-07 10:31:03 -04:00
jharshman
303a3e5160 vgo - strip out unused methods 2019-06-07 10:31:03 -04:00
jharshman
0bb1506d25 remove commented field in struct 2019-06-07 10:31:03 -04:00
jharshman
2fea75b02e vgo - add command working 2019-06-07 10:31:03 -04:00
jharshman
3c42f846c2 fix duplicated dir 2019-06-07 10:31:03 -04:00
jharshman
221bae3986 depricate package name flag 2019-06-07 10:31:03 -04:00
jharshman
b8ad19ad0d reorder some operations 2019-06-07 10:31:03 -04:00