mirror of
https://github.com/daveberrys/guh.git
synced 2026-11-29 00:46:45 +08:00
implement pr and issues browse
This commit is contained in:
1 parent
0c405b495f
commit
e2cc0e1006
3 files changed
+42
No files matched your search
@@ -0,0 +1,20 @@
|
||||
package browse
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/daveberrys/guh/src/utils"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/pkg/browser"
|
||||
)
|
||||
|
||||
var issuesCmd = &cobra.Command{
|
||||
Use: "issues",
|
||||
Short: "Opens a browser to the issues page.",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
url, err := utils.RunGit(true, "remote", "get-url", "origin")
|
||||
if err != nil { return err }
|
||||
url = strings.TrimSuffix(url, ".git")
|
||||
return browser.OpenURL(url + "/issues")
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package browse
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/daveberrys/guh/src/utils"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/pkg/browser"
|
||||
)
|
||||
|
||||
var prCmd = &cobra.Command{
|
||||
Use: "pr",
|
||||
Short: "Opens a browser to the PRs page.",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
url, err := utils.RunGit(true, "remote", "get-url", "origin")
|
||||
if err != nil { return err }
|
||||
url = strings.TrimSuffix(url, ".git")
|
||||
return browser.OpenURL(url + "/pulls")
|
||||
},
|
||||
}
|
||||
@@ -11,6 +11,8 @@ import (
|
||||
|
||||
func init() {
|
||||
cmd.RootCmd.AddCommand(createCmd)
|
||||
createCmd.AddCommand(prCmd)
|
||||
createCmd.AddCommand(issuesCmd)
|
||||
}
|
||||
|
||||
var createCmd = &cobra.Command{
|
||||
|
||||
Reference in new issue
Block a user