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>
* 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.
* 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
Issue Reference: https://github.com/spf13/cobra/issues/1056https://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.
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>
* fix: ensure that testproject is removed even after a failure
* fix: defer licenseFile
* style: simply defer os.RemoveAll
* cobra/cmd: add getProject test func