diff options
| author | demo <demo@antix1> | 2026-05-28 17:32:07 -0400 |
|---|---|---|
| committer | demo <demo@antix1> | 2026-05-28 17:32:07 -0400 |
| commit | 73f0ff9f11ff5f75a92adc5cd59f87b6fb019150 (patch) | |
| tree | ec99021bdb7cd2388606227f2cb0cc69960b6142 | |
| parent | 848481fd1a738225664fa398275fcd1afd61c4ff (diff) | |
feat: specify whether URL sources are both missing or both present
| -rw-r--r-- | main.go | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -3,7 +3,6 @@ package main import ( - "errors" "flag" "fmt" "log" @@ -70,7 +69,13 @@ func chooseFrom(urlArg, shortcode, shortcodeFilename string) (string, error) { shortcodeAbsent := (shortcode == "") if urlAbsent == shortcodeAbsent { - return "", errors.New("-url and -shortcode flags either both missing or both present") + messageSlug := "present" + + if urlAbsent { + messageSlug = "missing; need exactly one" + } + + return "", fmt.Errorf("-url and -shortcode flags both %s", messageSlug) } if urlAbsent { |
