aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-11-10 17:32:14 +0100
committerMichael Muré <batolettre@gmail.com>2019-11-10 17:33:44 +0100
commite0b15ee7644c20533156850e0be5a07597967450 (patch)
treea7ebd32de0b94b63ebe825c829de963470d03cab
parentf8cf3fea035d7f0ad0287166c3a5016777acf5ad (diff)
downloadgit-bug-e0b15ee7644c20533156850e0be5a07597967450.tar.gz
cli: rename "token" into "auth"
-rw-r--r--commands/bridge_auth.go (renamed from commands/bridge_token.go)27
-rw-r--r--commands/bridge_auth_add.go (renamed from commands/bridge_token_add.go)20
-rw-r--r--commands/bridge_auth_rm.go (renamed from commands/bridge_token_rm.go)10
-rw-r--r--commands/bridge_auth_show.go (renamed from commands/bridge_token_show.go)13
-rw-r--r--doc/man/git-bug-bridge-auth-add-token.1 (renamed from doc/man/git-bug-bridge-token-add.1)8
-rw-r--r--doc/man/git-bug-bridge-auth-rm.1 (renamed from doc/man/git-bug-bridge-token-rm.1)8
-rw-r--r--doc/man/git-bug-bridge-auth-show.1 (renamed from doc/man/git-bug-bridge-token-show.1)8
-rw-r--r--doc/man/git-bug-bridge-auth.129
-rw-r--r--doc/man/git-bug-bridge-token.129
-rw-r--r--doc/man/git-bug-bridge.12
-rw-r--r--doc/md/git-bug_bridge.md2
-rw-r--r--doc/md/git-bug_bridge_auth.md25
-rw-r--r--doc/md/git-bug_bridge_auth_add-token.md23
-rw-r--r--doc/md/git-bug_bridge_auth_rm.md22
-rw-r--r--doc/md/git-bug_bridge_auth_show.md22
-rw-r--r--doc/md/git-bug_bridge_token.md25
-rw-r--r--doc/md/git-bug_bridge_token_add.md23
-rw-r--r--doc/md/git-bug_bridge_token_rm.md22
-rw-r--r--doc/md/git-bug_bridge_token_show.md22
-rw-r--r--misc/bash_completion/git-bug98
-rw-r--r--misc/powershell_completion/git-bug36
-rw-r--r--misc/zsh_completion/git-bug80
22 files changed, 276 insertions, 278 deletions
diff --git a/commands/bridge_token.go b/commands/bridge_auth.go
index b9e2d49f..e7fce1bd 100644
--- a/commands/bridge_token.go
+++ b/commands/bridge_auth.go
@@ -2,7 +2,6 @@ package commands
import (
"fmt"
- "time"
"github.com/spf13/cobra"
@@ -12,7 +11,7 @@ import (
"github.com/MichaelMure/git-bug/util/colors"
)
-func runTokenBridge(cmd *cobra.Command, args []string) error {
+func runBridgeAuth(cmd *cobra.Command, args []string) error {
tokens, err := core.ListTokens(repo)
if err != nil {
return err
@@ -30,27 +29,25 @@ func runTokenBridge(cmd *cobra.Command, args []string) error {
}
func printToken(token *core.Token) {
- valueFmt := text.LeftPadMaxLine(token.Value, 15, 0)
- targetFmt := text.LeftPadMaxLine(token.Target, 7, 0)
- createTimeFmt := text.LeftPadMaxLine(token.CreateTime.Format(time.RFC822), 20, 0)
+ targetFmt := text.LeftPadMaxLine(token.Target, 10, 0)
fmt.Printf("%s %s %s %s\n",
- token.ID().Human(),
- colors.Magenta(targetFmt),
- valueFmt,
- createTimeFmt,
+ colors.Cyan(token.ID().Human()),
+ colors.Yellow(targetFmt),
+ colors.Magenta("token"),
+ token.Value,
)
}
-var bridgeTokenCmd = &cobra.Command{
- Use: "token",
- Short: "List all known tokens.",
+var bridgeAuthCmd = &cobra.Command{
+ Use: "auth",
+ Short: "List all known bridge authentication credentials.",
PreRunE: loadRepo,
- RunE: runTokenBridge,
+ RunE: runBridgeAuth,
Args: cobra.NoArgs,
}
func init() {
- bridgeCmd.AddCommand(bridgeTokenCmd)
- bridgeTokenCmd.Flags().SortFlags = false
+ bridgeCmd.AddCommand(bridgeAuthCmd)
+ bridgeAuthCmd.Flags().SortFlags = false
}
diff --git a/commands/bridge_token_add.go b/commands/bridge_auth_add.go
index d2c697fa..ae2c4dbc 100644
--- a/commands/bridge_token_add.go
+++ b/commands/bridge_auth_add.go
@@ -15,17 +15,17 @@ import (
)
var (
- bridgeTokenTarget string
+ bridgeAuthAddTokenTarget string
)
func runBridgeTokenAdd(cmd *cobra.Command, args []string) error {
var value string
- if bridgeTokenTarget == "" {
- return fmt.Errorf("token target is required")
+ if bridgeAuthAddTokenTarget == "" {
+ return fmt.Errorf("auth target is required")
}
- if !core.TargetExist(bridgeTokenTarget) {
+ if !core.TargetExist(bridgeAuthAddTokenTarget) {
return fmt.Errorf("unknown target")
}
@@ -44,7 +44,7 @@ func runBridgeTokenAdd(cmd *cobra.Command, args []string) error {
value = strings.TrimSuffix(raw, "\n")
}
- token := core.NewToken(value, bridgeTokenTarget)
+ token := core.NewToken(value, bridgeAuthAddTokenTarget)
if err := token.Validate(); err != nil {
return errors.Wrap(err, "invalid token")
}
@@ -58,8 +58,8 @@ func runBridgeTokenAdd(cmd *cobra.Command, args []string) error {
return nil
}
-var bridgeTokenAddCmd = &cobra.Command{
- Use: "add",
+var bridgeAuthAddTokenCmd = &cobra.Command{
+ Use: "add-token [<token>]",
Short: "Store a new token",
PreRunE: loadRepo,
RunE: runBridgeTokenAdd,
@@ -67,8 +67,8 @@ var bridgeTokenAddCmd = &cobra.Command{
}
func init() {
- bridgeTokenCmd.AddCommand(bridgeTokenAddCmd)
- bridgeTokenAddCmd.Flags().StringVarP(&bridgeTokenTarget, "target", "t", "",
+ bridgeAuthCmd.AddCommand(bridgeAuthAddTokenCmd)
+ bridgeAuthAddTokenCmd.Flags().StringVarP(&bridgeAuthAddTokenTarget, "target", "t", "",
fmt.Sprintf("The target of the bridge. Valid values are [%s]", strings.Join(bridge.Targets(), ",")))
- bridgeTokenAddCmd.Flags().SortFlags = false
+ bridgeAuthAddTokenCmd.Flags().SortFlags = false
}
diff --git a/commands/bridge_token_rm.go b/commands/bridge_auth_rm.go
index a73fbb91..b0b4d437 100644
--- a/commands/bridge_token_rm.go
+++ b/commands/bridge_auth_rm.go
@@ -8,7 +8,7 @@ import (
"github.com/MichaelMure/git-bug/bridge/core"
)
-func runBridgeTokenRm(cmd *cobra.Command, args []string) error {
+func runBridgeAuthRm(cmd *cobra.Command, args []string) error {
token, err := core.LoadTokenPrefix(repo, args[0])
if err != nil {
return err
@@ -23,14 +23,14 @@ func runBridgeTokenRm(cmd *cobra.Command, args []string) error {
return nil
}
-var bridgeTokenRmCmd = &cobra.Command{
+var bridgeAuthRmCmd = &cobra.Command{
Use: "rm <id>",
- Short: "Remove a token.",
+ Short: "Remove a credential.",
PreRunE: loadRepo,
- RunE: runBridgeTokenRm,
+ RunE: runBridgeAuthRm,
Args: cobra.ExactArgs(1),
}
func init() {
- bridgeTokenCmd.AddCommand(bridgeTokenRmCmd)
+ bridgeAuthCmd.AddCommand(bridgeAuthRmCmd)
}
diff --git a/commands/bridge_token_show.go b/commands/bridge_auth_show.go
index 2d2e824d..94141b93 100644
--- a/commands/bridge_token_show.go
+++ b/commands/bridge_auth_show.go
@@ -9,28 +9,29 @@ import (
"github.com/MichaelMure/git-bug/bridge/core"
)
-func runBridgeTokenShow(cmd *cobra.Command, args []string) error {
+func runBridgeAuthShow(cmd *cobra.Command, args []string) error {
token, err := core.LoadTokenPrefix(repo, args[0])
if err != nil {
return err
}
fmt.Printf("Id: %s\n", token.ID())
- fmt.Printf("Value: %s\n", token.Value)
fmt.Printf("Target: %s\n", token.Target)
+ fmt.Printf("Type: token\n")
+ fmt.Printf("Value: %s\n", token.Value)
fmt.Printf("Creation: %s\n", token.CreateTime.Format(time.RFC822))
return nil
}
-var bridgeTokenShowCmd = &cobra.Command{
+var bridgeAuthShowCmd = &cobra.Command{
Use: "show",
- Short: "Display a token.",
+ Short: "Display an authentication credential.",
PreRunE: loadRepo,
- RunE: runBridgeTokenShow,
+ RunE: runBridgeAuthShow,
Args: cobra.ExactArgs(1),
}
func init() {
- bridgeTokenCmd.AddCommand(bridgeTokenShowCmd)
+ bridgeAuthCmd.AddCommand(bridgeAuthShowCmd)
}
diff --git a/doc/man/git-bug-bridge-token-add.1 b/doc/man/git-bug-bridge-auth-add-token.1
index 9b8a0db8..a76ed793 100644
--- a/doc/man/git-bug-bridge-token-add.1
+++ b/doc/man/git-bug-bridge-auth-add-token.1
@@ -5,12 +5,12 @@
.SH NAME
.PP
-git\-bug\-bridge\-token\-add \- Store a new token
+git\-bug\-bridge\-auth\-add\-token \- Store a new token
.SH SYNOPSIS
.PP
-\fBgit\-bug bridge token add [flags]\fP
+\fBgit\-bug bridge auth add\-token [<token>] [flags]\fP
.SH DESCRIPTION
@@ -25,9 +25,9 @@ Store a new token
.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
- help for add
+ help for add\-token
.SH SEE ALSO
.PP
-\fBgit\-bug\-bridge\-token(1)\fP
+\fBgit\-bug\-bridge\-auth(1)\fP
diff --git a/doc/man/git-bug-bridge-token-rm.1 b/doc/man/git-bug-bridge-auth-rm.1
index 217d938d..b0222b72 100644
--- a/doc/man/git-bug-bridge-token-rm.1
+++ b/doc/man/git-bug-bridge-auth-rm.1
@@ -5,17 +5,17 @@
.SH NAME
.PP
-git\-bug\-bridge\-token\-rm \- Remove a token.
+git\-bug\-bridge\-auth\-rm \- Remove a credential.
.SH SYNOPSIS
.PP
-\fBgit\-bug bridge token rm <id> [flags]\fP
+\fBgit\-bug bridge auth rm <id> [flags]\fP
.SH DESCRIPTION
.PP
-Remove a token.
+Remove a credential.
.SH OPTIONS
@@ -26,4 +26,4 @@ Remove a token.
.SH SEE ALSO
.PP
-\fBgit\-bug\-bridge\-token(1)\fP
+\fBgit\-bug\-bridge\-auth(1)\fP
diff --git a/doc/man/git-bug-bridge-token-show.1 b/doc/man/git-bug-bridge-auth-show.1
index f40b5024..6e0d345c 100644
--- a/doc/man/git-bug-bridge-token-show.1
+++ b/doc/man/git-bug-bridge-auth-show.1
@@ -5,17 +5,17 @@
.SH NAME
.PP
-git\-bug\-bridge\-token\-show \- Display a token.
+git\-bug\-bridge\-auth\-show \- Display an authentication credential.
.SH SYNOPSIS
.PP
-\fBgit\-bug bridge token show [flags]\fP
+\fBgit\-bug bridge auth show [flags]\fP
.SH DESCRIPTION
.PP
-Display a token.
+Display an authentication credential.
.SH OPTIONS
@@ -26,4 +26,4 @@ Display a token.
.SH SEE ALSO
.PP
-\fBgit\-bug\-bridge\-token(1)\fP
+\fBgit\-bug\-bridge\-auth(1)\fP
diff --git a/doc/man/git-bug-bridge-auth.1 b/doc/man/git-bug-bridge-auth.1
new file mode 100644
index 00000000..0e400c41
--- /dev/null
+++ b/doc/man/git-bug-bridge-auth.1
@@ -0,0 +1,29 @@
+.TH "GIT-BUG" "1" "Apr 2019" "Generated from git-bug's source code" ""
+.nh
+.ad l
+
+
+.SH NAME
+.PP
+git\-bug\-bridge\-auth \- List all known bridge authentication credentials.
+
+
+.SH SYNOPSIS
+.PP
+\fBgit\-bug bridge auth [flags]\fP
+
+
+.SH DESCRIPTION
+.PP
+List all known bridge authentication credentials.
+
+
+.SH OPTIONS
+.PP
+\fB\-h\fP, \fB\-\-help\fP[=false]
+ help for auth
+
+
+.SH SEE ALSO
+.PP
+\fBgit\-bug\-bridge(1)\fP, \fBgit\-bug\-bridge\-auth\-add\-token(1)\fP, \fBgit\-bug\-bridge\-auth\-rm(1)\fP, \fBgit\-bug\-bridge\-auth\-show(1)\fP
diff --git a/doc/man/git-bug-bridge-token.1 b/doc/man/git-bug-bridge-token.1
deleted file mode 100644
index f229bf76..00000000
--- a/doc/man/git-bug-bridge-token.1
+++ /dev/null
@@ -1,29 +0,0 @@
-.TH "GIT-BUG" "1" "Apr 2019" "Generated from git-bug's source code" ""
-.nh
-.ad l
-
-
-.SH NAME
-.PP
-git\-bug\-bridge\-token \- List all known tokens.
-
-
-.SH SYNOPSIS
-.PP
-\fBgit\-bug bridge token [flags]\fP
-
-
-.SH DESCRIPTION
-.PP
-List all known tokens.
-
-
-.SH OPTIONS
-.PP
-\fB\-h\fP, \fB\-\-help\fP[=false]
- help for token
-
-
-.SH SEE ALSO
-.PP
-\fBgit\-bug\-bridge(1)\fP, \fBgit\-bug\-bridge\-token\-add(1)\fP, \fBgit\-bug\-bridge\-token\-rm(1)\fP, \fBgit\-bug\-bridge\-token\-show(1)\fP
diff --git a/doc/man/git-bug-bridge.1 b/doc/man/git-bug-bridge.1
index f7e3ff85..8e885f10 100644
--- a/doc/man/git-bug-bridge.1
+++ b/doc/man/git-bug-bridge.1
@@ -26,4 +26,4 @@ Configure and use bridges to other bug trackers.
.SH SEE ALSO
.PP
-\fBgit\-bug(1)\fP, \fBgit\-bug\-bridge\-configure(1)\fP, \fBgit\-bug\-bridge\-pull(1)\fP, \fBgit\-bug\-bridge\-push(1)\fP, \fBgit\-bug\-bridge\-rm(1)\fP, \fBgit\-bug\-bridge\-token(1)\fP
+\fBgit\-bug(1)\fP, \fBgit\-bug\-bridge\-auth(1)\fP, \fBgit\-bug\-bridge\-configure(1)\fP, \fBgit\-bug\-bridge\-pull(1)\fP, \fBgit\-bug\-bridge\-push(1)\fP, \fBgit\-bug\-bridge\-rm(1)\fP
diff --git a/doc/md/git-bug_bridge.md b/doc/md/git-bug_bridge.md
index 073d23ff..3ddb9892 100644
--- a/doc/md/git-bug_bridge.md
+++ b/doc/md/git-bug_bridge.md
@@ -19,9 +19,9 @@ git-bug bridge [flags]
### SEE ALSO
* [git-bug](git-bug.md) - A bug tracker embedded in Git.
+* [git-bug bridge auth](git-bug_bridge_auth.md) - List all known bridge authentication credentials.
* [git-bug bridge configure](git-bug_bridge_configure.md) - Configure a new bridge.
* [git-bug bridge pull](git-bug_bridge_pull.md) - Pull updates.
* [git-bug bridge push](git-bug_bridge_push.md) - Push updates.
* [git-bug bridge rm](git-bug_bridge_rm.md) - Delete a configured bridge.
-* [git-bug bridge token](git-bug_bridge_token.md) - List all known tokens.
diff --git a/doc/md/git-bug_bridge_auth.md b/doc/md/git-bug_bridge_auth.md
new file mode 100644
index 00000000..e953f0ec
--- /dev/null
+++ b/doc/md/git-bug_bridge_auth.md
@@ -0,0 +1,25 @@
+## git-bug bridge auth
+
+List all known bridge authentication credentials.
+
+### Synopsis
+
+List all known bridge authentication credentials.
+
+```
+git-bug bridge auth [flags]
+```
+
+### Options
+
+```
+ -h, --help help for auth
+```
+
+### SEE ALSO
+
+* [git-bug bridge](git-bug_bridge.md) - Configure and use bridges to other bug trackers.
+* [git-bug bridge auth add-token](git-bug_bridge_auth_add-token.md) - Store a new token
+* [git-bug bridge auth rm](git-bug_bridge_auth_rm.md) - Remove a credential.
+* [git-bug bridge auth show](git-bug_bridge_auth_show.md) - Display an authentication credential.
+
diff --git a/doc/md/git-bug_bridge_auth_add-token.md b/doc/md/git-bug_bridge_auth_add-token.md
new file mode 100644
index 00000000..7067c3ca
--- /dev/null
+++ b/doc/md/git-bug_bridge_auth_add-token.md
@@ -0,0 +1,23 @@
+## git-bug bridge auth add-token
+
+Store a new token
+
+### Synopsis
+
+Store a new token
+
+```
+git-bug bridge auth add-token [<token>] [flags]
+```
+
+### Options
+
+```
+ -t, --target string The target of the bridge. Valid values are [github,gitlab,launchpad-preview]
+ -h, --help help for add-token
+```
+
+### SEE ALSO
+
+* [git-bug bridge auth](git-bug_bridge_auth.md) - List all known bridge authentication credentials.
+
diff --git a/doc/md/git-bug_bridge_auth_rm.md b/doc/md/git-bug_bridge_auth_rm.md
new file mode 100644
index 00000000..059aa43d
--- /dev/null
+++ b/doc/md/git-bug_bridge_auth_rm.md
@@ -0,0 +1,22 @@
+## git-bug bridge auth rm
+
+Remove a credential.
+
+### Synopsis
+
+Remove a credential.
+
+```
+git-bug bridge auth rm <id> [flags]
+```
+
+### Options
+
+```
+ -h, --help help for rm
+```
+
+### SEE ALSO
+
+* [git-bug bridge auth](git-bug_bridge_auth.md) - List all known bridge authentication credentials.
+
diff --git a/doc/md/git-bug_bridge_auth_show.md b/doc/md/git-bug_bridge_auth_show.md
new file mode 100644
index 00000000..5da3820f
--- /dev/null
+++ b/doc/md/git-bug_bridge_auth_show.md
@@ -0,0 +1,22 @@
+## git-bug bridge auth show
+
+Display an authentication credential.
+
+### Synopsis
+
+Display an authentication credential.
+
+```
+git-bug bridge auth show [flags]
+```
+
+### Options
+
+```
+ -h, --help help for show
+```
+
+### SEE ALSO
+
+* [git-bug bridge auth](git-bug_bridge_auth.md) - List all known bridge authentication credentials.
+
diff --git a/doc/md/git-bug_bridge_token.md b/doc/md/git-bug_bridge_token.md
deleted file mode 100644
index 14663784..00000000
--- a/doc/md/git-bug_bridge_token.md
+++ /dev/null
@@ -1,25 +0,0 @@
-## git-bug bridge token
-
-List all known tokens.
-
-### Synopsis
-
-List all known tokens.
-
-```
-git-bug bridge token [flags]
-```
-
-### Options
-
-```
- -h, --help help for token
-```
-
-### SEE ALSO
-
-* [git-bug bridge](git-bug_bridge.md) - Configure and use bridges to other bug trackers.
-* [git-bug bridge token add](git-bug_bridge_token_add.md) - Store a new token
-* [git-bug bridge token rm](git-bug_bridge_token_rm.md) - Remove a token.
-* [git-bug bridge token show](git-bug_bridge_token_show.md) - Display a token.
-
diff --git a/doc/md/git-bug_bridge_token_add.md b/doc/md/git-bug_bridge_token_add.md
deleted file mode 100644
index 1c0e5bbc..00000000
--- a/doc/md/git-bug_bridge_token_add.md
+++ /dev/null
@@ -1,23 +0,0 @@
-## git-bug bridge token add
-
-Store a new token
-
-### Synopsis
-
-Store a new token
-
-```
-git-bug bridge token add [flags]
-```
-
-### Options
-
-```
- -t, --target string The target of the bridge. Valid values are [github,gitlab,launchpad-preview]
- -h, --help help for add
-```
-
-### SEE ALSO
-
-* [git-bug bridge token](git-bug_bridge_token.md) - List all known tokens.
-
diff --git a/doc/md/git-bug_bridge_token_rm.md b/doc/md/git-bug_bridge_token_rm.md
deleted file mode 100644
index 534406f4..00000000
--- a/doc/md/git-bug_bridge_token_rm.md
+++ /dev/null
@@ -1,22 +0,0 @@
-## git-bug bridge token rm
-
-Remove a token.
-
-### Synopsis
-
-Remove a token.
-
-```
-git-bug bridge token rm <id> [flags]
-```
-
-### Options
-
-```
- -h, --help help for rm
-```
-
-### SEE ALSO
-
-* [git-bug bridge token](git-bug_bridge_token.md) - List all known tokens.
-
diff --git a/doc/md/git-bug_bridge_token_show.md b/doc/md/git-bug_bridge_token_show.md
deleted file mode 100644
index 80439617..00000000
--- a/doc/md/git-bug_bridge_token_show.md
+++ /dev/null
@@ -1,22 +0,0 @@
-## git-bug bridge token show
-
-Display a token.
-
-### Synopsis
-
-Display a token.
-
-```
-git-bug bridge token show [flags]
-```
-
-### Options
-
-```
- -h, --help help for show
-```
-
-### SEE ALSO
-
-* [git-bug bridge token](git-bug_bridge_token.md) - List all known tokens.
-
diff --git a/misc/bash_completion/git-bug b/misc/bash_completion/git-bug
index e8126b8f..9dc3ac87 100644
--- a/misc/bash_completion/git-bug
+++ b/misc/bash_completion/git-bug
@@ -287,9 +287,9 @@ _git-bug_add()
noun_aliases=()
}
-_git-bug_bridge_configure()
+_git-bug_bridge_auth_add-token()
{
- last_command="git-bug_bridge_configure"
+ last_command="git-bug_bridge_auth_add-token"
command_aliases=()
@@ -301,41 +301,19 @@ _git-bug_bridge_configure()
flags_with_completion=()
flags_completion=()
- flags+=("--name=")
- two_word_flags+=("--name")
- two_word_flags+=("-n")
- local_nonpersistent_flags+=("--name=")
flags+=("--target=")
two_word_flags+=("--target")
two_word_flags+=("-t")
local_nonpersistent_flags+=("--target=")
- flags+=("--url=")
- two_word_flags+=("--url")
- two_word_flags+=("-u")
- local_nonpersistent_flags+=("--url=")
- flags+=("--owner=")
- two_word_flags+=("--owner")
- two_word_flags+=("-o")
- local_nonpersistent_flags+=("--owner=")
- flags+=("--token=")
- two_word_flags+=("--token")
- two_word_flags+=("-T")
- local_nonpersistent_flags+=("--token=")
- flags+=("--token-stdin")
- local_nonpersistent_flags+=("--token-stdin")
- flags+=("--project=")
- two_word_flags+=("--project")
- two_word_flags+=("-p")
- local_nonpersistent_flags+=("--project=")
must_have_one_flag=()
must_have_one_noun=()
noun_aliases=()
}
-_git-bug_bridge_pull()
+_git-bug_bridge_auth_rm()
{
- last_command="git-bug_bridge_pull"
+ last_command="git-bug_bridge_auth_rm"
command_aliases=()
@@ -347,22 +325,15 @@ _git-bug_bridge_pull()
flags_with_completion=()
flags_completion=()
- flags+=("--no-resume")
- flags+=("-n")
- local_nonpersistent_flags+=("--no-resume")
- flags+=("--since=")
- two_word_flags+=("--since")
- two_word_flags+=("-s")
- local_nonpersistent_flags+=("--since=")
must_have_one_flag=()
must_have_one_noun=()
noun_aliases=()
}
-_git-bug_bridge_push()
+_git-bug_bridge_auth_show()
{
- last_command="git-bug_bridge_push"
+ last_command="git-bug_bridge_auth_show"
command_aliases=()
@@ -380,13 +351,16 @@ _git-bug_bridge_push()
noun_aliases=()
}
-_git-bug_bridge_rm()
+_git-bug_bridge_auth()
{
- last_command="git-bug_bridge_rm"
+ last_command="git-bug_bridge_auth"
command_aliases=()
commands=()
+ commands+=("add-token")
+ commands+=("rm")
+ commands+=("show")
flags=()
two_word_flags=()
@@ -400,9 +374,9 @@ _git-bug_bridge_rm()
noun_aliases=()
}
-_git-bug_bridge_token_add()
+_git-bug_bridge_configure()
{
- last_command="git-bug_bridge_token_add"
+ last_command="git-bug_bridge_configure"
command_aliases=()
@@ -414,19 +388,41 @@ _git-bug_bridge_token_add()
flags_with_completion=()
flags_completion=()
+ flags+=("--name=")
+ two_word_flags+=("--name")
+ two_word_flags+=("-n")
+ local_nonpersistent_flags+=("--name=")
flags+=("--target=")
two_word_flags+=("--target")
two_word_flags+=("-t")
local_nonpersistent_flags+=("--target=")
+ flags+=("--url=")
+ two_word_flags+=("--url")
+ two_word_flags+=("-u")
+ local_nonpersistent_flags+=("--url=")
+ flags+=("--owner=")
+ two_word_flags+=("--owner")
+ two_word_flags+=("-o")
+ local_nonpersistent_flags+=("--owner=")
+ flags+=("--token=")
+ two_word_flags+=("--token")
+ two_word_flags+=("-T")
+ local_nonpersistent_flags+=("--token=")
+ flags+=("--token-stdin")
+ local_nonpersistent_flags+=("--token-stdin")
+ flags+=("--project=")
+ two_word_flags+=("--project")
+ two_word_flags+=("-p")
+ local_nonpersistent_flags+=("--project=")
must_have_one_flag=()
must_have_one_noun=()
noun_aliases=()
}
-_git-bug_bridge_token_rm()
+_git-bug_bridge_pull()
{
- last_command="git-bug_bridge_token_rm"
+ last_command="git-bug_bridge_pull"
command_aliases=()
@@ -438,15 +434,22 @@ _git-bug_bridge_token_rm()
flags_with_completion=()
flags_completion=()
+ flags+=("--no-resume")
+ flags+=("-n")
+ local_nonpersistent_flags+=("--no-resume")
+ flags+=("--since=")
+ two_word_flags+=("--since")
+ two_word_flags+=("-s")
+ local_nonpersistent_flags+=("--since=")
must_have_one_flag=()
must_have_one_noun=()
noun_aliases=()
}
-_git-bug_bridge_token_show()
+_git-bug_bridge_push()
{
- last_command="git-bug_bridge_token_show"
+ last_command="git-bug_bridge_push"
command_aliases=()
@@ -464,16 +467,13 @@ _git-bug_bridge_token_show()
noun_aliases=()
}
-_git-bug_bridge_token()
+_git-bug_bridge_rm()
{
- last_command="git-bug_bridge_token"
+ last_command="git-bug_bridge_rm"
command_aliases=()
commands=()
- commands+=("add")
- commands+=("rm")
- commands+=("show")
flags=()
two_word_flags=()
@@ -494,11 +494,11 @@ _git-bug_bridge()
command_aliases=()
commands=()
+ commands+=("auth")
commands+=("configure")
commands+=("pull")
commands+=("push")
commands+=("rm")
- commands+=("token")
flags=()
two_word_flags=()
diff --git a/misc/powershell_completion/git-bug b/misc/powershell_completion/git-bug
index 6a7bf0c3..5f043932 100644
--- a/misc/powershell_completion/git-bug
+++ b/misc/powershell_completion/git-bug
@@ -48,11 +48,28 @@ Register-ArgumentCompleter -Native -CommandName 'git-bug' -ScriptBlock {
break
}
'git-bug;bridge' {
+ [CompletionResult]::new('auth', 'auth', [CompletionResultType]::ParameterValue, 'List all known bridge authentication credentials.')
[CompletionResult]::new('configure', 'configure', [CompletionResultType]::ParameterValue, 'Configure a new bridge.')
[CompletionResult]::new('pull', 'pull', [CompletionResultType]::ParameterValue, 'Pull updates.')
[CompletionResult]::new('push', 'push', [CompletionResultType]::ParameterValue, 'Push updates.')
[CompletionResult]::new('rm', 'rm', [CompletionResultType]::ParameterValue, 'Delete a configured bridge.')
- [CompletionResult]::new('token', 'token', [CompletionResultType]::ParameterValue, 'List all known tokens.')
+ break
+ }
+ 'git-bug;bridge;auth' {
+ [CompletionResult]::new('add-token', 'add-token', [CompletionResultType]::ParameterValue, 'Store a new token')
+ [CompletionResult]::new('rm', 'rm', [CompletionResultType]::ParameterValue, 'Remove a credential.')
+ [CompletionResult]::new('show', 'show', [CompletionResultType]::ParameterValue, 'Display an authentication credential.')
+ break
+ }
+ 'git-bug;bridge;auth;add-token' {
+ [CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'The target of the bridge. Valid values are [github,gitlab,launchpad-preview]')
+ [CompletionResult]::new('--target', 'target', [CompletionResultType]::ParameterName, 'The target of the bridge. Valid values are [github,gitlab,launchpad-preview]')
+ break
+ }
+ 'git-bug;bridge;auth;rm' {
+ break
+ }
+ 'git-bug;bridge;auth;show' {
break
}
'git-bug;bridge;configure' {
@@ -84,23 +101,6 @@ Register-ArgumentCompleter -Native -CommandName 'git-bug' -ScriptBlock {
'git-bug;bridge;rm' {
break
}
- 'git-bug;bridge;token' {
- [CompletionResult]::new('add', 'add', [CompletionResultType]::ParameterValue, 'Store a new token')
- [CompletionResult]::new('rm', 'rm', [CompletionResultType]::ParameterValue, 'Remove a token.')
- [CompletionResult]::new('show', 'show', [CompletionResultType]::ParameterValue, 'Display a token.')
- break
- }
- 'git-bug;bridge;token;add' {
- [CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'The target of the bridge. Valid values are [github,gitlab,launchpad-preview]')
- [CompletionResult]::new('--target', 'target', [CompletionResultType]::ParameterName, 'The target of the bridge. Valid values are [github,gitlab,launchpad-preview]')
- break
- }
- 'git-bug;bridge;token;rm' {
- break
- }
- 'git-bug;bridge;token;show' {
- break
- }
'git-bug;commands' {
[CompletionResult]::new('-p', 'p', [CompletionResultType]::ParameterName, 'Output the command description as well as Markdown compatible comment')
[CompletionResult]::new('--pretty', 'pretty', [CompletionResultType]::ParameterName, 'Output the command description as well as Markdown compatible comment')
diff --git a/misc/zsh_completion/git-bug b/misc/zsh_completion/git-bug
index f0ff7edf..230061dd 100644
--- a/misc/zsh_completion/git-bug
+++ b/misc/zsh_completion/git-bug
@@ -114,17 +114,20 @@ function _git-bug_bridge {
case $state in
cmnds)
commands=(
+ "auth:List all known bridge authentication credentials."
"configure:Configure a new bridge."
"pull:Pull updates."
"push:Push updates."
"rm:Delete a configured bridge."
- "token:List all known tokens."
)
_describe "command" commands
;;
esac
case "$words[1]" in
+ auth)
+ _git-bug_bridge_auth
+ ;;
configure)
_git-bug_bridge_configure
;;
@@ -137,39 +140,11 @@ function _git-bug_bridge {
rm)
_git-bug_bridge_rm
;;
- token)
- _git-bug_bridge_token
- ;;
esac
}
-function _git-bug_bridge_configure {
- _arguments \
- '(-n --name)'{-n,--name}'[A distinctive name to identify the bridge]:' \
- '(-t --target)'{-t,--target}'[The target of the bridge. Valid values are [github,gitlab,launchpad-preview]]:' \
- '(-u --url)'{-u,--url}'[The URL of the target repository]:' \
- '(-o --owner)'{-o,--owner}'[The owner of the target repository]:' \
- '(-T --token)'{-T,--token}'[The authentication token for the API]:' \
- '--token-stdin[Will read the token from stdin and ignore --token]' \
- '(-p --project)'{-p,--project}'[The name of the target repository]:'
-}
-
-function _git-bug_bridge_pull {
- _arguments \
- '(-n --no-resume)'{-n,--no-resume}'[force importing all bugs]' \
- '(-s --since)'{-s,--since}'[import only bugs updated after the given date (ex: "200h" or "june 2 2019")]:'
-}
-
-function _git-bug_bridge_push {
- _arguments
-}
-
-function _git-bug_bridge_rm {
- _arguments
-}
-
-function _git-bug_bridge_token {
+function _git-bug_bridge_auth {
local -a commands
_arguments -C \
@@ -179,37 +154,62 @@ function _git-bug_bridge_token {
case $state in
cmnds)
commands=(
- "add:Store a new token"
- "rm:Remove a token."
- "show:Display a token."
+ "add-token:Store a new token"
+ "rm:Remove a credential."
+ "show:Display an authentication credential."
)
_describe "command" commands
;;
esac
case "$words[1]" in
- add)
- _git-bug_bridge_token_add
+ add-token)
+ _git-bug_bridge_auth_add-token
;;
rm)
- _git-bug_bridge_token_rm
+ _git-bug_bridge_auth_rm
;;
show)
- _git-bug_bridge_token_show
+ _git-bug_bridge_auth_show
;;
esac
}
-function _git-bug_bridge_token_add {
+function _git-bug_bridge_auth_add-token {
_arguments \
'(-t --target)'{-t,--target}'[The target of the bridge. Valid values are [github,gitlab,launchpad-preview]]:'
}
-function _git-bug_bridge_token_rm {
+function _git-bug_bridge_auth_rm {
+ _arguments
+}
+
+function _git-bug_bridge_auth_show {
+ _arguments
+}
+
+function _git-bug_bridge_configure {
+ _arguments \
+ '(-n --name)'{-n,--name}'[A distinctive name to identify the bridge]:' \
+ '(-t --target)'{-t,--target}'[The target of the bridge. Valid values are [github,gitlab,launchpad-preview]]:' \
+ '(-u --url)'{-u,--url}'[The URL of the target repository]:' \
+ '(-o --owner)'{-o,--owner}'[The owner of the target repository]:' \
+ '(-T --token)'{-T,--token}'[The authentication token for the API]:' \
+ '--token-stdin[Will read the token from stdin and ignore --token]' \
+ '(-p --project)'{-p,--project}'[The name of the target repository]:'
+}
+
+function _git-bug_bridge_pull {
+ _arguments \
+ '(-n --no-resume)'{-n,--no-resume}'[force importing all bugs]' \
+ '(-s --since)'{-s,--since}'[import only bugs updated after the given date (ex: "200h" or "june 2 2019")]:'
+}
+
+function _git-bug_bridge_push {
_arguments
}
-function _git-bug_bridge_token_show {
+function _git-bug_bridge_rm {
_arguments
}