adding --browse option to most command which should open the issue in your favorite browser

This commit is contained in:
Cory Bennett
2015-02-16 10:34:04 -08:00
parent b7bdb43471
commit 21d9f74635
4 changed files with 74 additions and 47 deletions
+10
View File
@@ -297,3 +297,13 @@ func (c *Cli) editTemplate(template string, tmpFilePrefix string, templateData m
}
return nil
}
func (c *Cli) Browse(issue string) {
if val, ok := c.opts["browse"]; ok && val == "true" {
if runtime.GOOS == "darwin" {
exec.Command("open", fmt.Sprintf("%s/browse/%s", c.endpoint, issue)).Run()
} else if runtime.GOOS == "linux" {
exec.Command("xdg-open", fmt.Sprintf("%s/browse/%s", c.endpoint, issue)).Run()
}
}
}