mirror of
https://github.com/Threnklyn/jira.git
synced 2026-06-01 18:58:26 +02:00
27f57b2bbe
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.
31 lines
832 B
Go
31 lines
832 B
Go
package jiracmd
|
|
|
|
import (
|
|
"github.com/coryb/figtree"
|
|
"github.com/coryb/oreo"
|
|
jira "github.com/go-jira/jira"
|
|
"github.com/go-jira/jira/jiracli"
|
|
"github.com/pkg/browser"
|
|
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
|
)
|
|
|
|
func CmdBrowseRegistry() *jiracli.CommandRegistryEntry {
|
|
issue := ""
|
|
|
|
return &jiracli.CommandRegistryEntry{
|
|
"Open issue in browser",
|
|
func(fig *figtree.FigTree, cmd *kingpin.CmdClause) error {
|
|
cmd.Arg("ISSUE", "Issue to browse to").Required().StringVar(&issue)
|
|
return nil
|
|
},
|
|
func(o *oreo.Client, globals *jiracli.GlobalOptions) error {
|
|
return CmdBrowse(globals, issue)
|
|
},
|
|
}
|
|
}
|
|
|
|
// CmdBrowse open the default system browser to the provided issue
|
|
func CmdBrowse(globals *jiracli.GlobalOptions, issue string) error {
|
|
return browser.OpenURL(jira.URLJoin(globals.Endpoint.Value, "browse", issue))
|
|
}
|