create linking repo, cleanupo code

This commit is contained in:
daveberrys committed 2026-07-15 22:00:30 +08:00
1 parent e2cc0e1006
commit 2c476b8d2a
6 files changed
+63 -41

No files matched your search

+5 -1
View File
@@ -1,6 +1,8 @@
package createcmd
import (
"fmt"
"github.com/daveberrys/guh/src/utils"
"github.com/spf13/cobra"
)
@@ -10,6 +12,8 @@ var createBranchCmd = &cobra.Command{
Short: "Create and switch to a branch",
Args: cobra.ExactArgs(1),
RunE: func(c *cobra.Command, args []string) error {
return utils.RunGitSequence(false, []string{"switch", "-c", args[0]})
utils.RunGitSequence(false, []string{"switch", "-c", args[0]})
fmt.Printf("Created branch to: %s\n", args[0])
return nil
},
}
+19
View File
@@ -0,0 +1,19 @@
package createcmd
import (
"fmt"
"github.com/daveberrys/guh/src/utils"
"github.com/spf13/cobra"
)
var linkRepoCmd = &cobra.Command{
Use: "repo [url]",
Short: "Link a repository",
Args: cobra.ExactArgs(1),
RunE: func(c *cobra.Command, args []string) error {
utils.RunGitSequence(false, []string{"remote", "set-url", "origin", args[0]})
fmt.Printf("Linked repository to: %s\n", args[0])
return nil
},
}
+1
View File
@@ -9,6 +9,7 @@ func init() {
cmd.RootCmd.AddCommand(createCmd)
createCmd.AddCommand(createBranchCmd)
createCmd.AddCommand(createAccountCmd)
createCmd.AddCommand(linkRepoCmd)
}
var createCmd = &cobra.Command{