From 3f8679be9373ee7508d512dfdfc1dda0839c7f90 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Sat, 12 Sep 2026 20:14:47 +0200 Subject: krino: acting — trash, journal, apply, lock, review, undo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/krino/main.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'cmd/krino/main.go') 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) } -- cgit v1.3