diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2026-07-09 18:14:13 -0700 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2026-07-09 18:14:13 -0700 |
| commit | e0c5ea92cc6804ce82830c834f4987548c285359 (patch) | |
| tree | 0f7c1bbe2ec708b840f629e2c49e69fc00210c89 /git-shell-commands.go | |
| parent | Add a help command (diff) | |
| download | git-shell-commands-e0c5ea92cc6804ce82830c834f4987548c285359.tar.zst | |
Don't spam usage info on all errors
Diffstat (limited to 'git-shell-commands.go')
| -rw-r--r-- | git-shell-commands.go | 12 |
1 files changed, 6 insertions, 6 deletions
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) } } |
