From e0c5ea92cc6804ce82830c834f4987548c285359 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Thu, 9 Jul 2026 18:14:13 -0700 Subject: Don't spam usage info on all errors --- git-shell-commands.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'git-shell-commands.go') diff --git a/git-shell-commands.go b/git-shell-commands.go index 2040e23..1b530f0 100644 --- a/git-shell-commands.go +++ b/git-shell-commands.go @@ -15,7 +15,7 @@ const codeDir = "/nezuko/code/" func checkRepoName(name string) (string, error) { if strings.Contains(name, "/") { - return "", fmt.Errorf("invalid name %q: contains slashes") + return "", fmt.Errorf("invalid name %q: contains slashes", name) } if !strings.HasSuffix(name, ".git") { name += ".git" @@ -32,10 +32,10 @@ Create a new git repo named REPO. flag.Parse() args := flag.Args() if len(args) == 0 { - return fmt.Errorf("missing positional argument") + return fmt.Errorf("missing positional argument\nUse create -help for usage info") } if len(args) > 1 { - return fmt.Errorf("too many positional arguments") + return fmt.Errorf("too many positional arguments\nUse create -help for usage info") } name, err := checkRepoName(args[0]) if err != nil { @@ -77,10 +77,10 @@ Delete the git repo named REPO. flag.Parse() args := flag.Args() if len(args) == 0 { - return fmt.Errorf("missing positional argument") + return fmt.Errorf("missing positional argument\nUse delete -help for usage info") } if len(args) > 1 { - return fmt.Errorf("too many positional arguments") + return fmt.Errorf("too many positional arguments\nUse delete -help for usage info") } name, err := checkRepoName(args[0]) if err != nil { @@ -117,7 +117,7 @@ func main() { help() } if err != nil { - fmt.Fprintf(os.Stderr, "%s\nUse %s -help for usage info\n", err, cmd) + fmt.Fprintln(os.Stderr, err) os.Exit(1) } } -- cgit v1.3.1