aboutsummaryrefslogtreecommitdiff
path: root/cmd/krino/main.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-09-12 20:14:47 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-09-12 20:14:47 +0200
commit3f8679be9373ee7508d512dfdfc1dda0839c7f90 (patch)
treeec02eb075f6c4e90f21baa2fe674e86a2f7f6a62 /cmd/krino/main.go
parent24a84671ace373ae331fa83a1ff484990f4dff0e (diff)
downloadkrino-3f8679be9373ee7508d512dfdfc1dda0839c7f90.tar.gz
krino-3f8679be9373ee7508d512dfdfc1dda0839c7f90.zip
krino: acting — trash, journal, apply, lock, review, undo
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)
}