mirror of
https://github.com/daveberrys/guh.git
synced 2026-11-29 00:26:46 +08:00
branch listing cmd
This commit is contained in:
1 parent
f21745e063
commit
e40387c817
2 files changed
+9
-3
No files matched your search
@@ -214,9 +214,10 @@ Switch to an existing branch.
|
|||||||
|
|
||||||
```
|
```
|
||||||
guh switch branch <name>
|
guh switch branch <name>
|
||||||
|
guh switch branch list
|
||||||
```
|
```
|
||||||
|
|
||||||
Equivalent to `git switch <name>`.
|
Equivalent to `git switch <name>`. Listing all branches is equivalent to `git branch`.
|
||||||
|
|
||||||
### `account`
|
### `account`
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,13 @@ var switchBranchCmd = &cobra.Command{
|
|||||||
Short: "Switch to a specific branch",
|
Short: "Switch to a specific branch",
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
RunE: func(c *cobra.Command, args []string) error {
|
RunE: func(c *cobra.Command, args []string) error {
|
||||||
utils.RunGitSequence(false, []string{"switch", args[0]})
|
if args[0] == "list" {
|
||||||
fmt.Printf("Switched to branch: %s\n", args[0])
|
utils.RunGit(false, "branch")
|
||||||
|
} else {
|
||||||
|
utils.RunGitSequence(false, []string{"switch", args[0]})
|
||||||
|
fmt.Printf("Switched to branch: %s\n", args[0])
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user