Commit Graph

1009 Commits

Author SHA1 Message Date
Alessandro (Ale) Segala ed7b60e298
YAML documentation contains "Usage" (#1037) 2020-06-15 16:51:03 -06:00
Vaibhav Kaushik 1d3ac910d4
Update projects_using_cobra.md (#1113)
* Removing deprecated projects
* Update etcd website
2020-05-29 10:17:41 -06:00
Joshua Harshman 94a87a7b83
disable periodic labeler (#1112) 2020-05-08 09:53:33 -06:00
Marc Khouzam 5155946348
Ignore required flags when DisableFlagParsing (#1095)
When a command request to DisableFlagParsing, it should not fail due
to a missing required flag.  In fact, such a check will always fail
since flags weren't parsed!

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
2020-05-07 19:18:16 -06:00
Stefan Majer aa5badda62
Metal Stack CLI is using cobra as well (#1094) 2020-05-07 19:13:20 -06:00
John Calabrese a7aaa7cfac
replace labeler action with periodic-labeler (#1097)
* replace labeler action with periodic-labeler

this replaces the default labeler as it
does not label PRs from forks properly.

with periodic-labeler it should apply labels on
a cron to any PR and resolve the below bug:

https://github.com/spf13/cobra/issues/1092
2020-05-07 19:02:17 -06:00
Marc Khouzam f8fdd17383
Complete command names even if ValidArgs present (#1088)
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
2020-05-07 15:04:14 -06:00
John McBride e392f3204d
Man pages won't have auto gen tag when option is disabled (#1104)
* Man pages wont have  auto gen tag when option is disabled

- this addresses #741

* Add documentation for doc generation and a changelog
2020-04-29 11:15:55 -06:00
Warren Fernandes 41fd44e1df
Fix cobra init cmd help documentation (#1108)
Adds tests for other cases where we do not expect projects to be created
for absolute paths and relative paths in GOPATH.
2020-04-28 16:59:18 -06:00
Warren Fernandes 44d55fb4d3
Fix cobra command README (#1106)
Describes the behavior of custom LICENSE generation using properties in
~/.cobra.yml
2020-04-28 11:49:46 -06:00
Marc Khouzam 11ba63fc3b
Add Helm as project using Cobra (#1103)
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
2020-04-25 09:03:04 -06:00
Warren Fernandes 090d94f474
Move projects using Cobra (#1090)
Since there are so many projects using Cobra, we created a separate
document to list them
2020-04-16 11:00:24 -06:00
Amit Botzer 8c638d3f90
Fixed typo. (#1087)
Changed 'applicaton' to 'application'.
2020-04-10 15:30:10 -06:00
Marc Khouzam a684a6d7f5
Fish completion using Go completion (#1048)
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
2020-04-10 13:56:28 -06:00
John McBride 7fead4bf3b
Remove/replace SetOutput on Command - deprecated (#1078)
Replace SetOutput on Command - deprecated
2020-04-06 11:36:04 -06:00
Julien 47414285f9
Add Github CLI to list of projects using Cobra (#1034) 2020-04-06 11:30:17 -06:00
Marc Khouzam b84ef40338
Rename BashCompDirectives to ShellCompDirectives (#1082)
Since the completion directives will be used for all shells, and that
these names will be consumed by users, this is a more appropriate name.

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
2020-04-06 11:28:44 -06:00
Marc Khouzam b80aeb17fc
Add support for custom completions in Go (#1035)
This commit allows programs using Cobra to code their custom completions
in Go instead of Bash.

The new ValidArgsFunction field is added for commands, similarly to
ValidArgs.  For flags, the new function
Command.RegisterFlagCompletionFunc() is added.

When either of the above functions is used, the bash completion script
will call the new hidden command '__complete', passing it all
command-line arguments. The '__complete' command will call
the function specified by Command.ValidArgsFunction or by
Command.RegisterFlagCompletionFunc to obtain completions from the
program itself.

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
2020-04-03 13:43:43 -06:00
John Calabrese 138b98f39d
add support for autolabel stale PR (#1075)
* add support for autolabel stale PR

automatically labels stale PRs

* stale label is kind/stale

updates the stale label to reflect
existing project labels

* adds a relevant stale message

for both PRs and issues there is now a more
descriptive and relevant message
when the action marks something stale

* no auto-close on stale issues/prs

uses the exempt flag to ignore issues already marked
stale. this will allow us to auto label stale,
and then ignore them so they do not get auto
closed.
2020-04-02 10:55:31 -06:00
John Calabrese d88d9a09e9
Add Labeler Actions (#1074)
* adds labels to PRs

this will label PRs such that 
the maintainers have visibility into 
the breadth of the changes being suggested

* Create labeler.yml

* add all shell completions to labeler

any changes to and autocomplete for any shell
will now be auto labelled as impacting the autocompletion functionality
2020-04-02 09:26:08 -06:00
Joshua Harshman bbffa3aa94
rm circle ci badge (#1073) 2020-04-01 10:27:47 -06:00
Kanji Yomoda f62883520e
Replace deprecated SetOutput func with SetOut and SetErr in test (#1053) 2020-04-01 10:25:22 -06:00
Joshua Harshman 6607e6b860
Partial Revert of #922 (#1068)
Issue Reference: https://github.com/spf13/cobra/issues/1056

https://github.com/spf13/cobra/pull/922 introduced a new error
type that emitted when a command was not runnable. This caused
all commands w/o a run function set to error w/ that message and a status code of 1.

This change reverts the addition of that new error. Similar
functionality can be accomplished by leveraging RunE.
2020-03-27 14:38:32 -06:00
Dave Henderson 95f2f73ed9
Add short version flag -v when not otherwise set (#996)
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
2020-02-28 11:13:40 -07: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