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) {
|
||||
// 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, ":")
|
||||
if len(parts) < 3 {
|
||||
return nil, fmt.Errorf("cannot parse line: %s", line)
|
||||
|
|
13
cmd/token.go
13
cmd/token.go
|
@ -8,16 +8,16 @@ import (
|
|||
|
||||
func TokenSetJiraCmd() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "jira",
|
||||
Short: "Sets the value of the jira token",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: tokenSetJiraCmdF,
|
||||
Use: "jira USERNAME TOKEN",
|
||||
Short: "Sets the value of the jira token",
|
||||
Args: cobra.ExactArgs(2),
|
||||
RunE: tokenSetJiraCmdF,
|
||||
}
|
||||
}
|
||||
|
||||
func TokenSetGithubCmd() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "github",
|
||||
Use: "github TOKEN",
|
||||
Short: "Sets the value of the github token",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: tokenSetGithubCmdF,
|
||||
|
@ -57,7 +57,8 @@ func tokenSetJiraCmdF(cmd *cobra.Command, args []string) error {
|
|||
ErrorAndExit(cmd, err)
|
||||
}
|
||||
|
||||
cfg.JiraToken = args[0]
|
||||
cfg.JiraUsername = args[0]
|
||||
cfg.JiraToken = args[1]
|
||||
if err := config.SaveConfig(cfg); err != nil {
|
||||
ErrorAndExit(cmd, err)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package model
|
||||
|
||||
type Config struct {
|
||||
GithubToken string `json:"github_token"`
|
||||
JiraToken string `json:"jira_token"`
|
||||
GithubToken string `json:"github_token"`
|
||||
JiraUsername string `json:"jira_username"`
|
||||
JiraToken string `json:"jira_token"`
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue