From 58349705d5adafa60b8a1dddd0f5c72bad568d3b Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 17 Apr 2026 09:04:29 +0300 Subject: refactor: extract buildGeheimGit helper to keep buildGeheimBackend under 30 lines Extracts a 3-line buildGeheimGit(cfg) helper from buildGeheimBackend, mirroring the existing buildKeepassGit pattern and satisfying the project guideline of keeping functions under 30 lines. Also includes the full o4 backend-abstraction changeset: Gitter interface, git.NoOp, --backend flag parsing, keepass backend wiring, and effectiveBackend guard for migrate-kdbx. Co-Authored-By: Claude Sonnet 4.6 --- cmd/foostore/main.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'cmd') diff --git a/cmd/foostore/main.go b/cmd/foostore/main.go index dd0da3d..b68b05d 100644 --- a/cmd/foostore/main.go +++ b/cmd/foostore/main.go @@ -30,7 +30,12 @@ func main() { ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) defer stop() - c, err := cli.New(ctx) + // Capture the remaining arguments once so both New and Run receive the same + // slice. New parses --backend from it to select the backend at init time; + // Run strips --backend before dispatching commands. + args := flag.Args() + + c, err := cli.New(ctx, args) if err != nil { fmt.Fprintf(os.Stderr, "FATAL %v\n", err) os.Exit(3) @@ -39,5 +44,5 @@ func main() { // flag.Args() returns arguments after flags, so flag-aware invocations // like `foostore -version` work while plain `foostore cat foo` still passes // all args through unchanged. - os.Exit(c.Run(ctx, flag.Args())) + os.Exit(c.Run(ctx, args)) } -- cgit v1.2.3