diff options
-rw-r--r-- | bridge/core/auth/credential.go | 5 | ||||
-rw-r--r-- | bridge/core/bridge.go | 10 | ||||
-rw-r--r-- | bridge/github/config.go | 5 | ||||
-rw-r--r-- | bridge/gitlab/config.go | 5 | ||||
-rw-r--r-- | bridge/launchpad/config.go | 5 | ||||
-rw-r--r-- | doc/man/git-bug-bridge-auth-add-token.1 | 2 | ||||
-rw-r--r-- | doc/man/git-bug-bridge-configure.1 | 2 | ||||
-rw-r--r-- | doc/md/git-bug_bridge_auth_add-token.md | 2 | ||||
-rw-r--r-- | doc/md/git-bug_bridge_configure.md | 2 | ||||
-rw-r--r-- | input/prompt.go | 4 | ||||
-rw-r--r-- | misc/powershell_completion/git-bug | 8 | ||||
-rw-r--r-- | misc/zsh_completion/git-bug | 4 |
12 files changed, 19 insertions, 35 deletions
diff --git a/bridge/core/auth/credential.go b/bridge/core/auth/credential.go index 2814e94c..d95b23c7 100644 --- a/bridge/core/auth/credential.go +++ b/bridge/core/auth/credential.go @@ -171,10 +171,7 @@ func List(repo repository.RepoConfig, opts ...Option) ([]Credential, error) { return nil, err } - re, err := regexp.Compile(`^` + configKeyPrefix + `\.([^.]+)\.([^.]+(?:\.[^.]+)*)$`) - if err != nil { - panic(err) - } + re := regexp.MustCompile(`^` + configKeyPrefix + `\.([^.]+)\.([^.]+(?:\.[^.]+)*)$`) mapped := make(map[string]map[string]string) diff --git a/bridge/core/bridge.go b/bridge/core/bridge.go index 10f6b109..8c1f9714 100644 --- a/bridge/core/bridge.go +++ b/bridge/core/bridge.go @@ -155,10 +155,7 @@ func ConfiguredBridges(repo repository.RepoConfig) ([]string, error) { return nil, errors.Wrap(err, "can't read configured bridges") } - re, err := regexp.Compile(bridgeConfigKeyPrefix + `.([^.]+)`) - if err != nil { - panic(err) - } + re := regexp.MustCompile(bridgeConfigKeyPrefix + `.([^.]+)`) set := make(map[string]interface{}) @@ -194,10 +191,7 @@ func BridgeExist(repo repository.RepoConfig, name string) bool { // Remove a configured bridge func RemoveBridge(repo repository.RepoConfig, name string) error { - re, err := regexp.Compile(`^[a-zA-Z0-9]+`) - if err != nil { - panic(err) - } + re := regexp.MustCompile(`^[a-zA-Z0-9]+`) if !re.MatchString(name) { return fmt.Errorf("bad bridge fullname: %s", name) diff --git a/bridge/github/config.go b/bridge/github/config.go index 269c6144..b6f69d74 100644 --- a/bridge/github/config.go +++ b/bridge/github/config.go @@ -287,10 +287,7 @@ func promptToken() (*auth.Token, error) { fmt.Println(" - 'repo' : to be able to read private repositories") fmt.Println() - re, err := regexp.Compile(`^[a-zA-Z0-9]{40}$`) - if err != nil { - panic("regexp compile:" + err.Error()) - } + re := regexp.MustCompile(`^[a-zA-Z0-9]{40}$`) var login string diff --git a/bridge/gitlab/config.go b/bridge/gitlab/config.go index b730a365..d5dc418c 100644 --- a/bridge/gitlab/config.go +++ b/bridge/gitlab/config.go @@ -183,10 +183,7 @@ func promptToken(baseUrl string) (*auth.Token, error) { fmt.Println("'api' access scope: to be able to make api calls") fmt.Println() - re, err := regexp.Compile(`^[a-zA-Z0-9\-\_]{20}$`) - if err != nil { - panic("regexp compile:" + err.Error()) - } + re := regexp.MustCompile(`^[a-zA-Z0-9\-\_]{20}$`) var login string diff --git a/bridge/launchpad/config.go b/bridge/launchpad/config.go index 8567675f..dfff0d3d 100644 --- a/bridge/launchpad/config.go +++ b/bridge/launchpad/config.go @@ -91,10 +91,7 @@ func validateProject(project string) (bool, error) { // extract project name from url func splitURL(url string) (string, error) { - re, err := regexp.Compile(`launchpad\.net[\/:]([^\/]*[a-z]+)`) - if err != nil { - panic("regexp compile:" + err.Error()) - } + re := regexp.MustCompile(`launchpad\.net[\/:]([^\/]*[a-z]+)`) res := re.FindStringSubmatch(url) if res == nil { diff --git a/doc/man/git-bug-bridge-auth-add-token.1 b/doc/man/git-bug-bridge-auth-add-token.1 index c9ca55d6..717610e1 100644 --- a/doc/man/git-bug-bridge-auth-add-token.1 +++ b/doc/man/git-bug-bridge-auth-add-token.1 @@ -21,7 +21,7 @@ Store a new token .SH OPTIONS .PP \fB\-t\fP, \fB\-\-target\fP="" - The target of the bridge. Valid values are [github,gitlab,launchpad\-preview] + The target of the bridge. Valid values are [github,gitlab,jira,launchpad\-preview] .PP \fB\-l\fP, \fB\-\-login\fP="" diff --git a/doc/man/git-bug-bridge-configure.1 b/doc/man/git-bug-bridge-configure.1 index 385d0949..46594057 100644 --- a/doc/man/git-bug-bridge-configure.1 +++ b/doc/man/git-bug-bridge-configure.1 @@ -31,7 +31,7 @@ Configure a new bridge by passing flags or/and using interactive terminal prompt .PP \fB\-t\fP, \fB\-\-target\fP="" - The target of the bridge. Valid values are [github,gitlab,launchpad\-preview] + The target of the bridge. Valid values are [github,gitlab,jira,launchpad\-preview] .PP \fB\-u\fP, \fB\-\-url\fP="" diff --git a/doc/md/git-bug_bridge_auth_add-token.md b/doc/md/git-bug_bridge_auth_add-token.md index 496455a0..f0f8ac72 100644 --- a/doc/md/git-bug_bridge_auth_add-token.md +++ b/doc/md/git-bug_bridge_auth_add-token.md @@ -13,7 +13,7 @@ git-bug bridge auth add-token [<token>] [flags] ### Options ``` - -t, --target string The target of the bridge. Valid values are [github,gitlab,launchpad-preview] + -t, --target string The target of the bridge. Valid values are [github,gitlab,jira,launchpad-preview] -l, --login string The login in the remote bug-tracker -u, --user string The user to add the token to. Default is the current user -h, --help help for add-token diff --git a/doc/md/git-bug_bridge_configure.md b/doc/md/git-bug_bridge_configure.md index 9695684b..f89de404 100644 --- a/doc/md/git-bug_bridge_configure.md +++ b/doc/md/git-bug_bridge_configure.md @@ -72,7 +72,7 @@ git bug bridge configure \ ``` -n, --name string A distinctive name to identify the bridge - -t, --target string The target of the bridge. Valid values are [github,gitlab,launchpad-preview] + -t, --target string The target of the bridge. Valid values are [github,gitlab,jira,launchpad-preview] -u, --url string The URL of the remote repository -b, --base-url string The base URL of your remote issue tracker -l, --login string The login on your remote issue tracker diff --git a/input/prompt.go b/input/prompt.go index bd3fe4f0..12aa7b92 100644 --- a/input/prompt.go +++ b/input/prompt.go @@ -205,6 +205,8 @@ func PromptCredential(target, name string, credentials []auth.Credential, choice sort.Sort(auth.ById(credentials)) for { + _, _ = fmt.Fprintln(os.Stderr) + offset := 0 for i, choice := range choices { _, _ = fmt.Fprintf(os.Stderr, "[%d]: %s\n", i+1, choice) @@ -213,7 +215,7 @@ func PromptCredential(target, name string, credentials []auth.Credential, choice if len(credentials) > 0 { _, _ = fmt.Fprintln(os.Stderr) - _, _ = fmt.Fprintf(os.Stderr, "Existing %s for %s:", name, target) + _, _ = fmt.Fprintf(os.Stderr, "Existing %s for %s:\n", name, target) for i, cred := range credentials { meta := make([]string, 0, len(cred.Metadata())) diff --git a/misc/powershell_completion/git-bug b/misc/powershell_completion/git-bug index 54f7b7d0..59d2bf12 100644 --- a/misc/powershell_completion/git-bug +++ b/misc/powershell_completion/git-bug @@ -62,8 +62,8 @@ Register-ArgumentCompleter -Native -CommandName 'git-bug' -ScriptBlock { 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]') + [CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'The target of the bridge. Valid values are [github,gitlab,jira,launchpad-preview]') + [CompletionResult]::new('--target', 'target', [CompletionResultType]::ParameterName, 'The target of the bridge. Valid values are [github,gitlab,jira,launchpad-preview]') [CompletionResult]::new('-l', 'l', [CompletionResultType]::ParameterName, 'The login in the remote bug-tracker') [CompletionResult]::new('--login', 'login', [CompletionResultType]::ParameterName, 'The login in the remote bug-tracker') [CompletionResult]::new('-u', 'u', [CompletionResultType]::ParameterName, 'The user to add the token to. Default is the current user') @@ -79,8 +79,8 @@ Register-ArgumentCompleter -Native -CommandName 'git-bug' -ScriptBlock { 'git-bug;bridge;configure' { [CompletionResult]::new('-n', 'n', [CompletionResultType]::ParameterName, 'A distinctive name to identify the bridge') [CompletionResult]::new('--name', 'name', [CompletionResultType]::ParameterName, 'A distinctive name to identify the bridge') - [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]') + [CompletionResult]::new('-t', 't', [CompletionResultType]::ParameterName, 'The target of the bridge. Valid values are [github,gitlab,jira,launchpad-preview]') + [CompletionResult]::new('--target', 'target', [CompletionResultType]::ParameterName, 'The target of the bridge. Valid values are [github,gitlab,jira,launchpad-preview]') [CompletionResult]::new('-u', 'u', [CompletionResultType]::ParameterName, 'The URL of the remote repository') [CompletionResult]::new('--url', 'url', [CompletionResultType]::ParameterName, 'The URL of the remote repository') [CompletionResult]::new('-b', 'b', [CompletionResultType]::ParameterName, 'The base URL of your remote issue tracker') diff --git a/misc/zsh_completion/git-bug b/misc/zsh_completion/git-bug index edfff683..d28bd244 100644 --- a/misc/zsh_completion/git-bug +++ b/misc/zsh_completion/git-bug @@ -177,7 +177,7 @@ function _git-bug_bridge_auth { function _git-bug_bridge_auth_add-token { _arguments \ - '(-t --target)'{-t,--target}'[The target of the bridge. Valid values are [github,gitlab,launchpad-preview]]:' \ + '(-t --target)'{-t,--target}'[The target of the bridge. Valid values are [github,gitlab,jira,launchpad-preview]]:' \ '(-l --login)'{-l,--login}'[The login in the remote bug-tracker]:' \ '(-u --user)'{-u,--user}'[The user to add the token to. Default is the current user]:' } @@ -193,7 +193,7 @@ function _git-bug_bridge_auth_show { 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]]:' \ + '(-t --target)'{-t,--target}'[The target of the bridge. Valid values are [github,gitlab,jira,launchpad-preview]]:' \ '(-u --url)'{-u,--url}'[The URL of the remote repository]:' \ '(-b --base-url)'{-b,--base-url}'[The base URL of your remote issue tracker]:' \ '(-l --login)'{-l,--login}'[The login on your remote issue tracker]:' \ |