From bfc5ddc82034bc9005a9e2d603aa4e36fa91ece3 Mon Sep 17 00:00:00 2001 From: daveberrys <84567826+daveberrys@users.noreply.github.com> Date: Sun, 26 Jul 2026 18:34:26 +0800 Subject: [PATCH] branch w/o args shows branches, same with link --- src/cmd/branch/root.go | 6 +++++- src/cmd/branch/switch.go | 8 ++------ src/cmd/link/root.go | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/cmd/branch/root.go b/src/cmd/branch/root.go index 2476b4b..11aa77c 100644 --- a/src/cmd/branch/root.go +++ b/src/cmd/branch/root.go @@ -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") + }, } diff --git a/src/cmd/branch/switch.go b/src/cmd/branch/switch.go index 5c7fad2..5b4a13e 100644 --- a/src/cmd/branch/switch.go +++ b/src/cmd/branch/switch.go @@ -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]) - } + utils.RunGitSequence(false, []string{"switch", args[0]}) + fmt.Printf("Switched to branch: %s\n", args[0]) return nil }, } diff --git a/src/cmd/link/root.go b/src/cmd/link/root.go index cd8c271..65ce45b 100644 --- a/src/cmd/link/root.go +++ b/src/cmd/link/root.go @@ -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