Add bash autocompletion generator

Given a (potentially annotated) cobra command you can generate a bash
completion script.
This commit is contained in:
Eric Paris
2015-03-16 15:31:03 -04:00
parent f576d29563
commit 9b2e6822e5
5 changed files with 557 additions and 0 deletions

View File

@ -44,6 +44,10 @@ type Command struct {
Long string
// Examples of how to use the command
Example string
// List of all valid non-flag arguments, used for bash completions *TODO* actually validate these
ValidArgs []string
// Custom functions used by the bash autocompletion generator
BashCompletionFunction string
// Full set of flags
flags *flag.FlagSet
// Set of flags childrens of this command will inherit