branch w/o args shows branches, same with link

This commit is contained in:
daveberrys committed 2026-07-26 18:34:26 +08:00
1 parent cc1072a859
commit bfc5ddc820
3 files changed
+6 -6

No files matched your search

+5 -1
View File
@@ -5,6 +5,7 @@ package branch
import (
"github.com/daveberrys/guh/src/cmd"
"github.com/daveberrys/guh/src/utils"
"github.com/spf13/cobra"
)
@@ -18,5 +19,8 @@ func init() {
var branchCmd = &cobra.Command{
Use: "branch",
Short: "Manage branches",
Short: "Manage branches - No args given, lists all branches",
Run: func(c *cobra.Command, args []string) {
utils.RunGit(false, "branch")
},
}
-4
View File
@@ -15,12 +15,8 @@ var switchCmd = &cobra.Command{
Short: "Switch to a branch, or list branches with 'list'",
Args: cobra.ExactArgs(1),
RunE: func(c *cobra.Command, args []string) error {
if args[0] == "list" {
utils.RunGit(false, "branch")
} else {
utils.RunGitSequence(false, []string{"switch", args[0]})
fmt.Printf("Switched to branch: %s\n", args[0])
}
return nil
},
}
+1 -1
View File
@@ -17,7 +17,7 @@ func init() {
var linkCmd = &cobra.Command{
Use: "link",
Short: "Link repositories. Shows all linked repositories",
Short: "Link repositories. Shows all linked repositories - No args given, lists all remotes.",
RunE: func(c *cobra.Command, args []string) error {
utils.RunGit(false, "remote", "-v")
return nil