aboutsummaryrefslogtreecommitdiffstats
path: root/commands/bridge_auth_addtoken.go
diff options
context:
space:
mode:
authorJohannes Altmanninger <aclopte@gmail.com>2021-01-24 14:05:40 +0100
committerMichael Muré <batolettre@gmail.com>2022-05-01 10:54:13 +0200
commitbc6ba02bd84fc3bd86c61e89c16c400dfef01623 (patch)
treed6a88de7569493795544eedeb962a1dc859b8e71 /commands/bridge_auth_addtoken.go
parent8ee333582ff82d0df971309e94946f2f6e69475b (diff)
downloadgit-bug-bc6ba02bd84fc3bd86c61e89c16c400dfef01623.tar.gz
Add command-specific argument completions
Complete bug IDs, bridges, users, labels where appropriate. This works in bash and fish. ZSH is not yet supported by Cobra. In fish, descriptions (the part of a completion after the "\t") are shown as completion label, and can be searched with Ctrl+S. Reproduce with fish -C 'source misc/fish_completion/git-bug' git bug select ^I (tested with fish version 3.3.1) Also works with bash, but only for "git-bug" (with the dash) bash --rcfile <(echo source misc/bash_completion/git-bug) git-bug select ^I Closes #493
Diffstat (limited to 'commands/bridge_auth_addtoken.go')
-rw-r--r--commands/bridge_auth_addtoken.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/commands/bridge_auth_addtoken.go b/commands/bridge_auth_addtoken.go
index c0458fda..dfdc66b6 100644
--- a/commands/bridge_auth_addtoken.go
+++ b/commands/bridge_auth_addtoken.go
@@ -41,10 +41,12 @@ func newBridgeAuthAddTokenCommand() *cobra.Command {
flags.StringVarP(&options.target, "target", "t", "",
fmt.Sprintf("The target of the bridge. Valid values are [%s]", strings.Join(bridge.Targets(), ",")))
+ cmd.RegisterFlagCompletionFunc("target", completeFrom(bridge.Targets()))
flags.StringVarP(&options.login,
"login", "l", "", "The login in the remote bug-tracker")
flags.StringVarP(&options.user,
"user", "u", "", "The user to add the token to. Default is the current user")
+ cmd.RegisterFlagCompletionFunc("user", completeUser(env))
return cmd
}