Adds jira username to the config
This commit is contained in:
parent
18953f9372
commit
a289ed12ad
3 changed files with 12 additions and 8 deletions
|
@ -32,6 +32,8 @@ func AddCmd() *cobra.Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseLine(line string) (*model.Ticket, error) {
|
func parseLine(line string) (*model.Ticket, error) {
|
||||||
|
// ToDo: it would be great to be able to relate a line with its
|
||||||
|
// parent method, at least for JS and Golang
|
||||||
parts := strings.Split(line, ":")
|
parts := strings.Split(line, ":")
|
||||||
if len(parts) < 3 {
|
if len(parts) < 3 {
|
||||||
return nil, fmt.Errorf("cannot parse line: %s", line)
|
return nil, fmt.Errorf("cannot parse line: %s", line)
|
||||||
|
|
|
@ -8,16 +8,16 @@ import (
|
||||||
|
|
||||||
func TokenSetJiraCmd() *cobra.Command {
|
func TokenSetJiraCmd() *cobra.Command {
|
||||||
return &cobra.Command{
|
return &cobra.Command{
|
||||||
Use: "jira",
|
Use: "jira USERNAME TOKEN",
|
||||||
Short: "Sets the value of the jira token",
|
Short: "Sets the value of the jira token",
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(2),
|
||||||
RunE: tokenSetJiraCmdF,
|
RunE: tokenSetJiraCmdF,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TokenSetGithubCmd() *cobra.Command {
|
func TokenSetGithubCmd() *cobra.Command {
|
||||||
return &cobra.Command{
|
return &cobra.Command{
|
||||||
Use: "github",
|
Use: "github TOKEN",
|
||||||
Short: "Sets the value of the github token",
|
Short: "Sets the value of the github token",
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
RunE: tokenSetGithubCmdF,
|
RunE: tokenSetGithubCmdF,
|
||||||
|
@ -57,7 +57,8 @@ func tokenSetJiraCmdF(cmd *cobra.Command, args []string) error {
|
||||||
ErrorAndExit(cmd, err)
|
ErrorAndExit(cmd, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg.JiraToken = args[0]
|
cfg.JiraUsername = args[0]
|
||||||
|
cfg.JiraToken = args[1]
|
||||||
if err := config.SaveConfig(cfg); err != nil {
|
if err := config.SaveConfig(cfg); err != nil {
|
||||||
ErrorAndExit(cmd, err)
|
ErrorAndExit(cmd, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,5 +2,6 @@ package model
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
GithubToken string `json:"github_token"`
|
GithubToken string `json:"github_token"`
|
||||||
|
JiraUsername string `json:"jira_username"`
|
||||||
JiraToken string `json:"jira_token"`
|
JiraToken string `json:"jira_token"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue