From b0836cdca8954827ab148e6dfdba6eb33fcebd01 Mon Sep 17 00:00:00 2001 From: daveberrys <84567826+daveberrys@users.noreply.github.com> Date: Wed, 15 Jul 2026 22:01:20 +0800 Subject: [PATCH] added fallback error, input `what` outputs origin --- src/cmd/create/repo.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/cmd/create/repo.go b/src/cmd/create/repo.go index 8343cfa..23fbb2d 100644 --- a/src/cmd/create/repo.go +++ b/src/cmd/create/repo.go @@ -12,8 +12,16 @@ var linkRepoCmd = &cobra.Command{ 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 + switch args[0] { + case "": + 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 + } }, } \ No newline at end of file