implement pr and issues browse

This commit is contained in:
daveberrys committed 2026-07-15 20:19:14 +08:00
1 parent 0c405b495f
commit e2cc0e1006
3 files changed
+42

No files matched your search

+20
View File
@@ -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")
},
}
+20
View File
@@ -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")
},
}
+2
View File
@@ -11,6 +11,8 @@ import (
func init() { func init() {
cmd.RootCmd.AddCommand(createCmd) cmd.RootCmd.AddCommand(createCmd)
createCmd.AddCommand(prCmd)
createCmd.AddCommand(issuesCmd)
} }
var createCmd = &cobra.Command{ var createCmd = &cobra.Command{