mirror of
https://github.com/Threnklyn/jira.git
synced 2026-05-19 04:33:28 +02:00
add browse command and implement -b option for most operations
This commit is contained in:
+5
-15
@@ -47,7 +47,7 @@ type Exit struct {
|
||||
}
|
||||
|
||||
type GlobalOptions struct {
|
||||
Browse string `json:"browse,omitempty" yaml:"browse,omitempty"`
|
||||
Browse bool `json:"browse,omitempty" yaml:"browse,omitempty"`
|
||||
Editor string `json:"editor,omitempty" yaml:"editor,omitempty"`
|
||||
SkipEditing bool `json:"noedit,omitempty" yaml:"noedit,omitempty"`
|
||||
PasswordSource string `json:"password-source,omitempty" yaml:"password-source,omitempty"`
|
||||
@@ -87,6 +87,10 @@ func (jc *JiraCli) LoadConfigs(cmd *kingpin.CmdClause, opts interface{}) {
|
||||
})
|
||||
}
|
||||
|
||||
func (jc *JiraCli) BrowseUsage(cmd *kingpin.CmdClause, opts *GlobalOptions) {
|
||||
cmd.Flag("browse", "Open issue(s) in browser after operation").Short('b').BoolVar(&opts.Browse)
|
||||
}
|
||||
|
||||
func (jc *JiraCli) EditorUsage(cmd *kingpin.CmdClause, opts *GlobalOptions) {
|
||||
cmd.Flag("editor", "Editor to use").StringVar(&opts.Editor)
|
||||
}
|
||||
@@ -460,20 +464,6 @@ func (jc *JiraCli) editLoop(opts *GlobalOptions, input interface{}, output inter
|
||||
// return nil
|
||||
// }
|
||||
|
||||
// // Browse will open up your default browser to the provided issue
|
||||
// func (c *Cli) Browse(issue string) error {
|
||||
// if val, ok := c.opts["browse"].(bool); ok && val {
|
||||
// if runtime.GOOS == "darwin" {
|
||||
// return exec.Command("open", fmt.Sprintf("%s/browse/%s", c.endpoint, issue)).Run()
|
||||
// } else if runtime.GOOS == "linux" {
|
||||
// return exec.Command("xdg-open", fmt.Sprintf("%s/browse/%s", c.endpoint, issue)).Run()
|
||||
// } else if runtime.GOOS == "windows" {
|
||||
// return exec.Command("cmd", "/c", "start", fmt.Sprintf("%s/browse/%s", c.endpoint, issue)).Run()
|
||||
// }
|
||||
// }
|
||||
// return nil
|
||||
// }
|
||||
|
||||
// // SaveData will write out the yaml formated --saveFile file with provided data
|
||||
// func (c *Cli) SaveData(data interface{}) error {
|
||||
// if val, ok := c.opts["saveFile"].(string); ok && val != "" {
|
||||
|
||||
Reference in New Issue
Block a user