mirror of
https://github.com/MichaelMure/git-bug.git
synced 2024-12-14 17:51:44 +03:00
cli: rename "token" into "auth"
This commit is contained in:
parent
f8cf3fea03
commit
e0b15ee764
@ -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
|
||||
}
|
@ -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
|
||||
}
|
@ -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)
|
||||
}
|
@ -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)
|
||||
}
|
@ -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
|
@ -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
|
@ -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
|
29
doc/man/git-bug-bridge-auth.1
Normal file
29
doc/man/git-bug-bridge-auth.1
Normal file
@ -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
|
@ -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
|
@ -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
|
||||
|
@ -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.
|
||||
|
||||
|
25
doc/md/git-bug_bridge_auth.md
Normal file
25
doc/md/git-bug_bridge_auth.md
Normal file
@ -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.
|
||||
|
23
doc/md/git-bug_bridge_auth_add-token.md
Normal file
23
doc/md/git-bug_bridge_auth_add-token.md
Normal file
@ -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.
|
||||
|
22
doc/md/git-bug_bridge_auth_rm.md
Normal file
22
doc/md/git-bug_bridge_auth_rm.md
Normal file
@ -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.
|
||||
|
22
doc/md/git-bug_bridge_auth_show.md
Normal file
22
doc/md/git-bug_bridge_auth_show.md
Normal file
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -287,6 +287,93 @@ _git-bug_add()
|
||||
noun_aliases=()
|
||||
}
|
||||
|
||||
_git-bug_bridge_auth_add-token()
|
||||
{
|
||||
last_command="git-bug_bridge_auth_add-token"
|
||||
|
||||
command_aliases=()
|
||||
|
||||
commands=()
|
||||
|
||||
flags=()
|
||||
two_word_flags=()
|
||||
local_nonpersistent_flags=()
|
||||
flags_with_completion=()
|
||||
flags_completion=()
|
||||
|
||||
flags+=("--target=")
|
||||
two_word_flags+=("--target")
|
||||
two_word_flags+=("-t")
|
||||
local_nonpersistent_flags+=("--target=")
|
||||
|
||||
must_have_one_flag=()
|
||||
must_have_one_noun=()
|
||||
noun_aliases=()
|
||||
}
|
||||
|
||||
_git-bug_bridge_auth_rm()
|
||||
{
|
||||
last_command="git-bug_bridge_auth_rm"
|
||||
|
||||
command_aliases=()
|
||||
|
||||
commands=()
|
||||
|
||||
flags=()
|
||||
two_word_flags=()
|
||||
local_nonpersistent_flags=()
|
||||
flags_with_completion=()
|
||||
flags_completion=()
|
||||
|
||||
|
||||
must_have_one_flag=()
|
||||
must_have_one_noun=()
|
||||
noun_aliases=()
|
||||
}
|
||||
|
||||
_git-bug_bridge_auth_show()
|
||||
{
|
||||
last_command="git-bug_bridge_auth_show"
|
||||
|
||||
command_aliases=()
|
||||
|
||||
commands=()
|
||||
|
||||
flags=()
|
||||
two_word_flags=()
|
||||
local_nonpersistent_flags=()
|
||||
flags_with_completion=()
|
||||
flags_completion=()
|
||||
|
||||
|
||||
must_have_one_flag=()
|
||||
must_have_one_noun=()
|
||||
noun_aliases=()
|
||||
}
|
||||
|
||||
_git-bug_bridge_auth()
|
||||
{
|
||||
last_command="git-bug_bridge_auth"
|
||||
|
||||
command_aliases=()
|
||||
|
||||
commands=()
|
||||
commands+=("add-token")
|
||||
commands+=("rm")
|
||||
commands+=("show")
|
||||
|
||||
flags=()
|
||||
two_word_flags=()
|
||||
local_nonpersistent_flags=()
|
||||
flags_with_completion=()
|
||||
flags_completion=()
|
||||
|
||||
|
||||
must_have_one_flag=()
|
||||
must_have_one_noun=()
|
||||
noun_aliases=()
|
||||
}
|
||||
|
||||
_git-bug_bridge_configure()
|
||||
{
|
||||
last_command="git-bug_bridge_configure"
|
||||
@ -400,93 +487,6 @@ _git-bug_bridge_rm()
|
||||
noun_aliases=()
|
||||
}
|
||||
|
||||
_git-bug_bridge_token_add()
|
||||
{
|
||||
last_command="git-bug_bridge_token_add"
|
||||
|
||||
command_aliases=()
|
||||
|
||||
commands=()
|
||||
|
||||
flags=()
|
||||
two_word_flags=()
|
||||
local_nonpersistent_flags=()
|
||||
flags_with_completion=()
|
||||
flags_completion=()
|
||||
|
||||
flags+=("--target=")
|
||||
two_word_flags+=("--target")
|
||||
two_word_flags+=("-t")
|
||||
local_nonpersistent_flags+=("--target=")
|
||||
|
||||
must_have_one_flag=()
|
||||
must_have_one_noun=()
|
||||
noun_aliases=()
|
||||
}
|
||||
|
||||
_git-bug_bridge_token_rm()
|
||||
{
|
||||
last_command="git-bug_bridge_token_rm"
|
||||
|
||||
command_aliases=()
|
||||
|
||||
commands=()
|
||||
|
||||
flags=()
|
||||
two_word_flags=()
|
||||
local_nonpersistent_flags=()
|
||||
flags_with_completion=()
|
||||
flags_completion=()
|
||||
|
||||
|
||||
must_have_one_flag=()
|
||||
must_have_one_noun=()
|
||||
noun_aliases=()
|
||||
}
|
||||
|
||||
_git-bug_bridge_token_show()
|
||||
{
|
||||
last_command="git-bug_bridge_token_show"
|
||||
|
||||
command_aliases=()
|
||||
|
||||
commands=()
|
||||
|
||||
flags=()
|
||||
two_word_flags=()
|
||||
local_nonpersistent_flags=()
|
||||
flags_with_completion=()
|
||||
flags_completion=()
|
||||
|
||||
|
||||
must_have_one_flag=()
|
||||
must_have_one_noun=()
|
||||
noun_aliases=()
|
||||
}
|
||||
|
||||
_git-bug_bridge_token()
|
||||
{
|
||||
last_command="git-bug_bridge_token"
|
||||
|
||||
command_aliases=()
|
||||
|
||||
commands=()
|
||||
commands+=("add")
|
||||
commands+=("rm")
|
||||
commands+=("show")
|
||||
|
||||
flags=()
|
||||
two_word_flags=()
|
||||
local_nonpersistent_flags=()
|
||||
flags_with_completion=()
|
||||
flags_completion=()
|
||||
|
||||
|
||||
must_have_one_flag=()
|
||||
must_have_one_noun=()
|
||||
noun_aliases=()
|
||||
}
|
||||
|
||||
_git-bug_bridge()
|
||||
{
|
||||
last_command="git-bug_bridge"
|
||||
@ -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=()
|
||||
|
@ -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')
|
||||
|
@ -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,10 +140,52 @@ function _git-bug_bridge {
|
||||
rm)
|
||||
_git-bug_bridge_rm
|
||||
;;
|
||||
token)
|
||||
_git-bug_bridge_token
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
function _git-bug_bridge_auth {
|
||||
local -a commands
|
||||
|
||||
_arguments -C \
|
||||
"1: :->cmnds" \
|
||||
"*::arg:->args"
|
||||
|
||||
case $state in
|
||||
cmnds)
|
||||
commands=(
|
||||
"add-token:Store a new token"
|
||||
"rm:Remove a credential."
|
||||
"show:Display an authentication credential."
|
||||
)
|
||||
_describe "command" commands
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$words[1]" in
|
||||
add-token)
|
||||
_git-bug_bridge_auth_add-token
|
||||
;;
|
||||
rm)
|
||||
_git-bug_bridge_auth_rm
|
||||
;;
|
||||
show)
|
||||
_git-bug_bridge_auth_show
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
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_auth_rm {
|
||||
_arguments
|
||||
}
|
||||
|
||||
function _git-bug_bridge_auth_show {
|
||||
_arguments
|
||||
}
|
||||
|
||||
function _git-bug_bridge_configure {
|
||||
@ -168,51 +213,6 @@ function _git-bug_bridge_rm {
|
||||
_arguments
|
||||
}
|
||||
|
||||
|
||||
function _git-bug_bridge_token {
|
||||
local -a commands
|
||||
|
||||
_arguments -C \
|
||||
"1: :->cmnds" \
|
||||
"*::arg:->args"
|
||||
|
||||
case $state in
|
||||
cmnds)
|
||||
commands=(
|
||||
"add:Store a new token"
|
||||
"rm:Remove a token."
|
||||
"show:Display a token."
|
||||
)
|
||||
_describe "command" commands
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$words[1]" in
|
||||
add)
|
||||
_git-bug_bridge_token_add
|
||||
;;
|
||||
rm)
|
||||
_git-bug_bridge_token_rm
|
||||
;;
|
||||
show)
|
||||
_git-bug_bridge_token_show
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function _git-bug_bridge_token_add {
|
||||
_arguments \
|
||||
'(-t --target)'{-t,--target}'[The target of the bridge. Valid values are [github,gitlab,launchpad-preview]]:'
|
||||
}
|
||||
|
||||
function _git-bug_bridge_token_rm {
|
||||
_arguments
|
||||
}
|
||||
|
||||
function _git-bug_bridge_token_show {
|
||||
_arguments
|
||||
}
|
||||
|
||||
function _git-bug_commands {
|
||||
_arguments \
|
||||
'(-p --pretty)'{-p,--pretty}'[Output the command description as well as Markdown compatible comment]'
|
||||
|
Loading…
Reference in New Issue
Block a user