add browse command and implement -b option for most operations

This commit is contained in:
Cory Bennett
2017-08-20 23:19:43 -05:00
parent f32cc7079c
commit a91b9d56b0
95 changed files with 599 additions and 9853 deletions
+5 -15
View File
@@ -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 != "" {