-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd: add completion command for bash completion
- Loading branch information
1 parent
59a452f
commit ceb2629
Showing
3 changed files
with
27 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package cmd | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
var completionCmd = &cobra.Command{ | ||
Use: "completion", | ||
Short: "Generate shell completion code", | ||
} | ||
|
||
var bash = &cobra.Command{ | ||
Use: "bash", | ||
Short: "Generate bash completion code", | ||
Long: `This command generates bash CLI completion code. | ||
Add "source <(funnel completion bash)" to your bash profile.`, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
RootCmd.GenBashCompletion(os.Stdout) | ||
}, | ||
} | ||
|
||
func init() { | ||
completionCmd.AddCommand(bash) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters