From 298a637f8c1c122eff4463085c7b0ea5773b266b Mon Sep 17 00:00:00 2001 From: Ron Green <11993626+georgettica@users.noreply.github.com> Date: Sun, 2 May 2021 11:01:52 +0300 Subject: [PATCH] fix rebase issue --- jiracmd/create.go | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/jiracmd/create.go b/jiracmd/create.go index b5edea5..3abc884 100644 --- a/jiracmd/create.go +++ b/jiracmd/create.go @@ -47,6 +47,7 @@ func CmdCreateRegistry() *jiracli.CommandRegistryEntry { func CmdCreateUsage(cmd *kingpin.CmdClause, opts *CreateOptions) error { jiracli.BrowseUsage(cmd, &opts.CommonOptions) jiracli.EditorUsage(cmd, &opts.CommonOptions) + jiracli.FileUsage(cmd, &opts.CommonOptions) jiracli.TemplateUsage(cmd, &opts.CommonOptions) cmd.Flag("noedit", "Disable opening the editor").SetValue(&opts.SkipEditing) cmd.Flag("project", "project to create issue in").Short('p').StringVar(&opts.Project) @@ -94,16 +95,25 @@ func CmdCreate(o *oreo.Client, globals *jiracli.GlobalOptions, opts *CreateOptio input.Overrides["login"] = globals.Login.Value var issueResp *jiradata.IssueCreateResponse - err = jiracli.EditLoop(&opts.CommonOptions, &input, &issueUpdate, func() error { - if globals.JiraDeploymentType.Value == jiracli.CloudDeploymentType { - err := fixGDPRUserFields(o, globals.Endpoint.Value, createMeta.Fields, issueUpdate.Fields) - if err != nil { - return err + var fnameOptsFile string + fnameOptsFile = opts.File.String() + if fnameOptsFile != "" { + err = jiracli.ReadYmlInputFile(&opts.CommonOptions, &input, &issueUpdate, func() error { + issueResp, err = jira.CreateIssue(o, globals.Endpoint.Value, &issueUpdate) + return err + }) + } else { + err = jiracli.EditLoop(&opts.CommonOptions, &input, &issueUpdate, func() error { + if globals.JiraDeploymentType.Value == jiracli.CloudDeploymentType { + err := fixGDPRUserFields(o, globals.Endpoint.Value, createMeta.Fields, issueUpdate.Fields) + if err != nil { + return err + } } - } - issueResp, err = jira.CreateIssue(o, globals.Endpoint.Value, &issueUpdate) - return err - }) + issueResp, err = jira.CreateIssue(o, globals.Endpoint.Value, &issueUpdate) + return err + }) + } if err != nil { return err }