implement browse feature

This commit is contained in:
daveberrys committed 2026-07-15 20:14:50 +08:00
1 parent ed41c19bbf
commit 0c405b495f
5 files changed
+48 -8

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
package browse
import (
"strings"
"github.com/daveberrys/guh/src/cmd"
"github.com/daveberrys/guh/src/utils"
"github.com/spf13/cobra"
"github.com/pkg/browser"
)
func init() {
cmd.RootCmd.AddCommand(createCmd)
}
var createCmd = &cobra.Command{
Use: "browse",
Short: "Opens a browser to the repository.",
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)
},
}