mirror of
https://github.com/daveberrys/guh.git
synced 2026-11-29 00:26:46 +08:00
file cleanup, skill issue typing
This commit is contained in:
1 parent
b0836cdca8
commit
bb6ffb1271
2 files changed
+1
-34
No files matched your search
@@ -1,33 +0,0 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/daveberrys/guh/src/utils"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(renameCmd)
|
||||
renameCmd.AddCommand(renameBranchCmd)
|
||||
}
|
||||
|
||||
var renameCmd = &cobra.Command{
|
||||
Use: "rename",
|
||||
Short: "Rename branches",
|
||||
}
|
||||
|
||||
var renameBranchCmd = &cobra.Command{
|
||||
Use: "branch [name]",
|
||||
Short: "Rename a specific branch",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return renameBranch(args[0])
|
||||
},
|
||||
}
|
||||
|
||||
func renameBranch(branchName string) error {
|
||||
utils.RunGitSequence(false, []string{"branch", "-m", branchName})
|
||||
fmt.Println("Successfully renamed branch to", branchName)
|
||||
return nil
|
||||
}
|
||||
@@ -12,7 +12,7 @@ var switchBranchCmd = &cobra.Command{
|
||||
Short: "Switch to a specific branch",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(c *cobra.Command, args []string) error {
|
||||
utils.RunGitequence(false, []string{"switch", args[0]})
|
||||
utils.RunGitSequence(false, []string{"switch", args[0]})
|
||||
fmt.Printf("Switched to branch: %s\n", args[0])
|
||||
return nil
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user