summaryrefslogtreecommitdiff
path: root/parse.go
diff options
context:
space:
mode:
authorPablo Diaz <[email protected]>2022-05-21 17:44:32 +0200
committerIlja Neumann <[email protected]>2023-06-03 02:39:56 +0200
commit5f10667949b09f9a43c241d969eea8d3ba9456c0 (patch)
treef699c397356663d51f6f923cc49d78b4b5c31592 /parse.go
parentc3cac76438ca36d9291d2a26f3ba558ef929d588 (diff)
fixed tests
Diffstat (limited to 'parse.go')
-rw-r--r--parse.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/parse.go b/parse.go
index aee60e7..a85419f 100644
--- a/parse.go
+++ b/parse.go
@@ -360,6 +360,11 @@ func cmdFromStruct(name string, dest path, t reflect.Type) (*command, error) {
case strings.HasPrefix(key, "--"):
spec.long = key[2:]
case strings.HasPrefix(key, "-"):
+ if len(key) != 2 {
+ errs = append(errs, fmt.Sprintf("%s.%s: short arguments must be one character only",
+ t.Name(), field.Name))
+ return false
+ }
spec.short = key[1:]
case key == "required":
spec.required = true