summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-17 09:04:29 +0300
committerPaul Buetow <paul@buetow.org>2026-04-17 09:04:29 +0300
commit58349705d5adafa60b8a1dddd0f5c72bad568d3b (patch)
treeeefad461de05ad027936c44a3f73925ed1fce652 /cmd
parenteb89e32c6675d4ed50f66580346e5ea8f3d7b5b2 (diff)
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 <noreply@anthropic.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/foostore/main.go9
1 files changed, 7 insertions, 2 deletions
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))
}