Files
jira/jiracmd/epicCreate.go
T
Mike Pountney 27f57b2bbe Switch over to using github.com/go-jira/jira, from gopkg.in
There should be no reason to use gopkg.in versioned imports now that
we're using go modules. I think, IANAE.

gopkg.in kind of gets in the way of modules, as it only pulls over
tagged releases from github.com -- this then means that you need to use
go modules 'replace' syntax in the go.mod to use a non-versioned commit
or branch. This is feasible, but kind of ugly.

go modules defaults to pulling the latest version, so the default
behavior is the same as when pulling go-jira.v1 from gopkg.in.
2019-09-14 21:31:11 -07:00

49 lines
1.6 KiB
Go

package jiracmd
import (
"github.com/coryb/figtree"
"github.com/coryb/oreo"
"github.com/go-jira/jira/jiracli"
kingpin "gopkg.in/alecthomas/kingpin.v2"
)
func CmdEpicCreateRegistry() *jiracli.CommandRegistryEntry {
opts := CreateOptions{
CommonOptions: jiracli.CommonOptions{
Template: figtree.NewStringOption("epic-create"),
},
Overrides: map[string]string{},
}
return &jiracli.CommandRegistryEntry{
"Create Epic",
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
jiracli.LoadConfigs(cmd, fig, &opts)
return CmdEpicCreateUsage(cmd, &opts)
},
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
return CmdCreate(o, globals, &opts)
},
}
}
func CmdEpicCreateUsage(cmd *kingpin.CmdClause, opts *CreateOptions) error {
jiracli.BrowseUsage(cmd, &opts.CommonOptions)
jiracli.EditorUsage(cmd, &opts.CommonOptions)
jiracli.TemplateUsage(cmd, &opts.CommonOptions)
cmd.Flag("noedit", "Disable opening the editor").SetValue(&opts.SkipEditing)
cmd.Flag("project", "project to create epic in").Short('p').StringVar(&opts.Project)
cmd.Flag("epic-name", "Epic Name").Short('n').PreAction(func(ctx *kingpin.ParseContext) error {
opts.Overrides["epic-name"] = jiracli.FlagValue(ctx, "epic-name")
return nil
}).String()
cmd.Flag("comment", "Comment message for epic").Short('m').PreAction(func(ctx *kingpin.ParseContext) error {
opts.Overrides["comment"] = jiracli.FlagValue(ctx, "comment")
return nil
}).String()
cmd.Flag("override", "Set epic property").Short('o').StringMapVar(&opts.Overrides)
cmd.Flag("saveFile", "Write epic as yaml to file").StringVar(&opts.SaveFile)
return nil
}