mirror of
https://github.com/daveberrys/guh.git
synced 2026-11-29 00:46:45 +08:00
branch w/o args shows branches, same with link
This commit is contained in:
1 parent
cc1072a859
commit
bfc5ddc820
3 files changed
+6
-6
No files matched your search
@@ -5,6 +5,7 @@ package branch
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/daveberrys/guh/src/cmd"
|
"github.com/daveberrys/guh/src/cmd"
|
||||||
|
"github.com/daveberrys/guh/src/utils"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -18,5 +19,8 @@ func init() {
|
|||||||
|
|
||||||
var branchCmd = &cobra.Command{
|
var branchCmd = &cobra.Command{
|
||||||
Use: "branch",
|
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")
|
||||||
|
},
|
||||||
}
|
}
|
||||||
@@ -15,12 +15,8 @@ var switchCmd = &cobra.Command{
|
|||||||
Short: "Switch to a branch, or list branches with 'list'",
|
Short: "Switch to a branch, or list branches with 'list'",
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
RunE: func(c *cobra.Command, args []string) error {
|
RunE: func(c *cobra.Command, args []string) error {
|
||||||
if args[0] == "list" {
|
|
||||||
utils.RunGit(false, "branch")
|
|
||||||
} else {
|
|
||||||
utils.RunGitSequence(false, []string{"switch", args[0]})
|
utils.RunGitSequence(false, []string{"switch", args[0]})
|
||||||
fmt.Printf("Switched to branch: %s\n", args[0])
|
fmt.Printf("Switched to branch: %s\n", args[0])
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -17,7 +17,7 @@ func init() {
|
|||||||
|
|
||||||
var linkCmd = &cobra.Command{
|
var linkCmd = &cobra.Command{
|
||||||
Use: "link",
|
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 {
|
RunE: func(c *cobra.Command, args []string) error {
|
||||||
utils.RunGit(false, "remote", "-v")
|
utils.RunGit(false, "remote", "-v")
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in new issue
Block a user