diff options
author | Michael Muré <batolettre@gmail.com> | 2020-02-15 03:06:10 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2020-02-15 03:07:45 +0100 |
commit | 432a816dde18a12c1479ed8151a11c29929476e0 (patch) | |
tree | 89c965c63f07c1091ff34ec3d163171a73eba29f /bridge/core/params.go | |
parent | e9aff2a2a103b43852ecf7b57ae9ab297890eeed (diff) | |
parent | 362c0c7e2e1ce9a8e2918376a340c76f46569d64 (diff) | |
download | git-bug-432a816dde18a12c1479ed8151a11c29929476e0.tar.gz |
Merge remote-tracking branch 'origin/master' into cheshirekow-jira
Diffstat (limited to 'bridge/core/params.go')
-rw-r--r-- | bridge/core/params.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/bridge/core/params.go b/bridge/core/params.go new file mode 100644 index 00000000..e398b81a --- /dev/null +++ b/bridge/core/params.go @@ -0,0 +1,36 @@ +package core + +import "fmt" + +// BridgeParams holds parameters to simplify the bridge configuration without +// having to make terminal prompts. +type BridgeParams struct { + URL string // complete URL of a repo (Github, Gitlab, , Launchpad) + BaseURL string // base URL for self-hosted instance ( Gitlab, Jira, ) + Login string // username for the passed credential (Github, Gitlab, Jira, ) + CredPrefix string // ID prefix of the credential to use (Github, Gitlab, Jira, ) + TokenRaw string // pre-existing token to use (Github, Gitlab, , ) + Owner string // owner of the repo (Github, , , ) + Project string // name of the repo or project key (Github, , Jira, Launchpad) +} + +func (BridgeParams) fieldWarning(field string, target string) string { + switch field { + case "URL": + return fmt.Sprintf("warning: --url is ineffective for a %s bridge", target) + case "BaseURL": + return fmt.Sprintf("warning: --base-url is ineffective for a %s bridge", target) + case "Login": + return fmt.Sprintf("warning: --login is ineffective for a %s bridge", target) + case "CredPrefix": + return fmt.Sprintf("warning: --credential is ineffective for a %s bridge", target) + case "TokenRaw": + return fmt.Sprintf("warning: tokens are ineffective for a %s bridge", target) + case "Owner": + return fmt.Sprintf("warning: --owner is ineffective for a %s bridge", target) + case "Project": + return fmt.Sprintf("warning: --project is ineffective for a %s bridge", target) + default: + panic("unknown field") + } +} |