mirror of
https://github.com/daveberrys/guh.git
synced 2026-11-29 00:26:46 +08:00
re-add rename
don't know why it was gone in the first place...
This commit is contained in:
1 parent
a59dab1ef3
commit
e512398aba
1 file changed
+33
@@ -0,0 +1,33 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
Reference in new issue
Block a user