summaryrefslogtreecommitdiff
path: root/cmd/krino/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/krino/main.go')
-rw-r--r--cmd/krino/main.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/cmd/krino/main.go b/cmd/krino/main.go
index 9618f6c..e204b5f 100644
--- a/cmd/krino/main.go
+++ b/cmd/krino/main.go
@@ -9,6 +9,7 @@ import (
"fmt"
"io"
"os"
+ "strings"
)
// version is stamped by the Makefile with -ldflags "-X main.version=...".
@@ -71,6 +72,19 @@ func run(args []string, stdout, stderr io.Writer) int {
return cmd(g, rest[1:], stdout, stderr)
}
}
+ // Ruling 2026-09-12/4: Go's flag package stops parsing at the first
+ // non-flag argument, so "krino dl -n" leaves "-n" in rest as a second
+ // directory name instead of a flag - the dry run is silently never
+ // honoured. A leftover argument that still looks like a flag is a
+ // usage error rather than a guess; there is deliberately no second
+ // pass that re-parses trailing flags, which would make "krino --
+ // -weird-dir" ambiguous between the two syntaxes.
+ for _, a := range rest {
+ if strings.HasPrefix(a, "-") {
+ fmt.Fprintf(stderr, "krino: %s: flags must come before directory names\nrun 'krino -h' for help\n", a)
+ return 2
+ }
+ }
return cmdSort(g, rest, stdout, stderr)
}