Skip to content
Snippets Groups Projects
Commit 1c029d65 authored by vince's avatar vince
Browse files

Add exampleUrl code

parent 7821121e
No related branches found
No related tags found
No related merge requests found
...@@ -38,32 +38,31 @@ Successfully configured bridge: default ...@@ -38,32 +38,31 @@ Successfully configured bridge: default
# For Github # For Github
git bug bridge configure \ git bug bridge configure \
--target=github \ --target=github \
--url=https://github.com/MichaelMure/git-bug \ --login==$(LOGIN) \
--login=$(LOGIN) \ --owner==$(OWNER) \
--owner=$(OWNER) \ --project==$(PROJECT) \
--project=$(PROJECT) \
--token=$(TOKEN) \ --token=$(TOKEN) \
--url=https://github.com/MichaelMure/git-bug \
# For Gitlab # For Gitlab
git bug bridge configure \ git bug bridge configure \
--target=gitlab \ --target=gitlab \
--url=https://gitlab.com/gitlab-org/gitlab \ --login==$(LOGIN) \
--login=$(LOGIN) \
--token=$(TOKEN) \ --token=$(TOKEN) \
--url=https://gitlab.com/gitlab-org/gitlab \
# For Jira # For Jira
git bug bridge configure \ git bug bridge configure \
--target=jira \ --target=jira \
--url= \ --login==$(LOGIN) \
--login=$(LOGIN) \ --project==$(PROJECT) \
--project=$(PROJECT) \
# For Launchpad-Preview # For Launchpad-Preview
git bug bridge configure \ git bug bridge configure \
--target=launchpad-preview \ --target=launchpad-preview \
--project==$(PROJECT) \
--url=https://bugs.launchpad.net/ubuntu/ \ --url=https://bugs.launchpad.net/ubuntu/ \
--project=$(PROJECT) \
` `
...@@ -134,21 +134,17 @@ Successfully configured bridge: default ...@@ -134,21 +134,17 @@ Successfully configured bridge: default
exampleText.WriteString(strings.ToLower(b)) exampleText.WriteString(strings.ToLower(b))
exampleText.WriteString(" \\\n") exampleText.WriteString(" \\\n")
exampleText.WriteString(" --url=")
exampleText.WriteString(bridgeUrls[b])
exampleText.WriteString(" \\\n")
params, err := bridge.ValidParams(b) params, err := bridge.ValidParams(b)
if err != nil { if err != nil {
return errors.Wrap(err, "bridge parameters") return errors.Wrap(err, "bridge parameters")
} }
for _, param := range params { for _, param := range params {
if param == "URL" || param == "BaseURL" { if param == "BaseURL" {
continue continue
} }
paramString := formatParam(param, params) paramString := formatParam(param, params, b)
if paramString == "" { if paramString == "" {
continue continue
} }
...@@ -182,21 +178,23 @@ var bridgeConfigureExample =`) ...@@ -182,21 +178,23 @@ var bridgeConfigureExample =`)
return nil return nil
} }
const paramFormatString = " --%s=%s \\\n"
// formatParam formats a parameter into a flag example in the command line // formatParam formats a parameter into a flag example in the command line
func formatParam(param string, params []string) string { func formatParam(param string, params []string, bridge string) string {
paramString := " --"
if flagInfo, ok := flagInfos[param]; ok { if flagInfo, ok := flagInfos[param]; ok {
if checkParamConflicts(flagInfo.paramConflicts, params) { if checkParamConflicts(flagInfo.paramConflicts, params) {
return "" return ""
} }
paramString += flagInfo.flagName + "=" + flagInfo.defaultVal return fmt.Sprintf(paramFormatString, flagInfo.flagName, flagInfo.defaultVal)
} else { } else if param == "URL" {
paramString += strings.ToLower(param) + "=$(" + strings.ToUpper(param) + ")" if exampleUrl, ok := bridgeUrls[bridge]; ok {
return fmt.Sprintf(paramFormatString, "url", exampleUrl)
}
} }
paramString += " \\\n" return fmt.Sprintf(paramFormatString, strings.ToLower(param), "=$("+strings.ToUpper(param)+")")
return paramString
} }
// checkParamConflicts checks the parameter conflicts against the list of present parameters // checkParamConflicts checks the parameter conflicts against the list of present parameters
......
...@@ -111,33 +111,32 @@ Successfully configured bridge: default ...@@ -111,33 +111,32 @@ Successfully configured bridge: default
git bug bridge configure \\ git bug bridge configure \\
\-\-target=github \\ \-\-target=github \\
\-\-url=https://github.com/MichaelMure/git\-bug \\ \-\-url=https://github.com/MichaelMure/git\-bug \\
\-\-login=$(LOGIN) \\ \-\-url=https://github.com/MichaelMure/git\-bug \\
\-\-owner=$(OWNER) \\ \-\-url=https://github.com/MichaelMure/git\-bug \\
\-\-project=$(PROJECT) \\
\-\-token=$(TOKEN) \\ \-\-token=$(TOKEN) \\
\-\-url=https://github.com/MichaelMure/git\-bug \\
# For Gitlab # For Gitlab
git bug bridge configure \\ git bug bridge configure \\
\-\-target=gitlab \\ \-\-target=gitlab \\
\-\-url=https://gitlab.com/gitlab\-org/gitlab \\ \-\-url=https://gitlab.com/gitlab\-org/gitlab \\
\-\-login=$(LOGIN) \\
\-\-token=$(TOKEN) \\ \-\-token=$(TOKEN) \\
\-\-url=https://gitlab.com/gitlab\-org/gitlab \\
# For Jira # For Jira
git bug bridge configure \\ git bug bridge configure \\
\-\-target=jira \\ \-\-target=jira \\
\-\-url= \\ \-\-login==$(LOGIN) \\
\-\-login=$(LOGIN) \\ \-\-project==$(PROJECT) \\
\-\-project=$(PROJECT) \\
# For Launchpad\-Preview # For Launchpad\-Preview
git bug bridge configure \\ git bug bridge configure \\
\-\-target=launchpad\-preview \\ \-\-target=launchpad\-preview \\
\-\-url=https://bugs.launchpad.net/ubuntu/ \\ \-\-url=https://bugs.launchpad.net/ubuntu/ \\
\-\-project=$(PROJECT) \\ \-\-url=https://bugs.launchpad.net/ubuntu/ \\
.fi .fi
......
...@@ -50,33 +50,32 @@ Successfully configured bridge: default ...@@ -50,33 +50,32 @@ Successfully configured bridge: default
git bug bridge configure \ git bug bridge configure \
--target=github \ --target=github \
--url=https://github.com/MichaelMure/git-bug \ --url=https://github.com/MichaelMure/git-bug \
--login=$(LOGIN) \ --url=https://github.com/MichaelMure/git-bug \
--owner=$(OWNER) \ --url=https://github.com/MichaelMure/git-bug \
--project=$(PROJECT) \
--token=$(TOKEN) \ --token=$(TOKEN) \
--url=https://github.com/MichaelMure/git-bug \
# For Gitlab # For Gitlab
git bug bridge configure \ git bug bridge configure \
--target=gitlab \ --target=gitlab \
--url=https://gitlab.com/gitlab-org/gitlab \ --url=https://gitlab.com/gitlab-org/gitlab \
--login=$(LOGIN) \
--token=$(TOKEN) \ --token=$(TOKEN) \
--url=https://gitlab.com/gitlab-org/gitlab \
# For Jira # For Jira
git bug bridge configure \ git bug bridge configure \
--target=jira \ --target=jira \
--url= \ --login==$(LOGIN) \
--login=$(LOGIN) \ --project==$(PROJECT) \
--project=$(PROJECT) \
# For Launchpad-Preview # For Launchpad-Preview
git bug bridge configure \ git bug bridge configure \
--target=launchpad-preview \ --target=launchpad-preview \
--url=https://bugs.launchpad.net/ubuntu/ \ --url=https://bugs.launchpad.net/ubuntu/ \
--project=$(PROJECT) \ --url=https://bugs.launchpad.net/ubuntu/ \
``` ```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment