mirror of
https://github.com/daveberrys/guh.git
synced 2026-11-29 00:26:46 +08:00
added fallback error, input what outputs origin
This commit is contained in:
1 parent
2c476b8d2a
commit
b0836cdca8
1 file changed
+11
-3
+11
-3
@@ -12,8 +12,16 @@ var linkRepoCmd = &cobra.Command{
|
|||||||
Short: "Link a repository",
|
Short: "Link a repository",
|
||||||
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{"remote", "set-url", "origin", args[0]})
|
switch args[0] {
|
||||||
fmt.Printf("Linked repository to: %s\n", args[0])
|
case "":
|
||||||
return nil
|
return fmt.Errorf("repository URL cannot be empty")
|
||||||
|
case "what":
|
||||||
|
utils.RunGit(false, "remote", "get-url", "origin")
|
||||||
|
return nil
|
||||||
|
default:
|
||||||
|
utils.RunGitSequence(false, []string{"remote", "set-url", "origin", args[0]})
|
||||||
|
fmt.Printf("Linked repository to: %s\n", args[0])
|
||||||
|
return nil
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user