summaryrefslogtreecommitdiff
path: root/internal/cli/cli_test.go
AgeCommit message (Collapse)Author
2026-04-18refactor: extract migration logic into internal/migrate package (task q6)Paul Buetow
Move all geheim→KeePass migration business logic from internal/cli/migrate_kdbx.go into a new internal/migrate package (migrator.go, kdbx_store.go). The CLI layer is now a thin orchestrator: parse flags, open KDBX, call migrate.Run, save, report. Key design decisions: - migrate.Run accepts separate logFn (stdout info) and warnFn (stderr errors) so per-entry errors correctly route to stderr via warn(), not stdout via logMsg() - migrate.Options contains only DryRun; DBPath/BinaryOutDir removed (CLI-only concerns) - StoreWalker interface is narrow, avoiding a direct dependency on backend.Backend - cli_paths.go extracts readPasswordFile/resolveHomeDir/expandHome shared within cli - kdbx_store.go deleted from cli (moved to internal/migrate) - Duplicate TestExtractPasswordFromContent removed from kdbx_store_test.go - Custom contains/containsStr helpers replaced with strings.Contains in tests - Dry-run test now asserts logged message content Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18feat: make keepass the default backend with master.kdbx default pathPaul Buetow
Change default backend from "geheim" to "keepass" and default KDBXPath from ~/Documents/Keepass/master to ~/Documents/Keepass/master.kdbx. Existing geheim users must set backend="geheim" in ~/.config/foostore.json. Update resolveBackend fallback, struct comments, and test assertions to match. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18feat: add --kdbx-path CLI flag to override KeePass database path at runtimePaul Buetow
Allows specifying the .kdbx file path without editing the config file: foostore --backend keepass --kdbx-path /path/to/db.kdbx ls The flag overrides cfg.KDBXPath for the process lifetime. Implemented by extracting a shared parseFlagValue helper used by both parseBackendFlag and the new parseKDBXPathFlag. Help text updated to document both global flags. Table-driven tests added for parseKDBXPathFlag (mirrors TestParseBackendFlag). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-17refactor: extract buildGeheimGit helper to keep buildGeheimBackend under 30 ↵Paul Buetow
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>
2026-03-07Add KeePass migration command with text/password and binary attachment supportPaul Buetow
2026-03-02cli: add isolated dispatch routing tests (task 401)Paul Buetow
2026-03-02store: make Data carry injected deps (task 402)Paul Buetow
2026-03-02store/cli: deduplicate shred helper (task 400)Paul Buetow
2026-02-23Release v0.5.2v0.5.2Paul Buetow
2026-02-22Add unit tests to reach 63.3% coverage (task 335)Paul Buetow
- internal/shell/shell_internal_test.go (new): tests prefixCompleter.Do with table-driven cases covering empty prefix, partial match, no match, and multi-word line (prefix after space) - internal/cli/cli_test.go (new): tests pure helpers (logMsg, warn, printHelp, shredFile), dispatch paths with real store (ls, search, cat, rm, shred, get, paste, export, pathexport, open, edit, unknown command, empty argv), error paths for cmdAdd/cmdImport/cmdImportR, readPIN env-var path, completionFn commands-only path, makeActionFn nil cases - internal/store/store_test.go: added TestSearchActionPathExport, TestSearchActionWithCallback, TestSearchActionNilCallback, TestFzfEmpty, TestRemoveInteractiveInvalidThenDecline, TestImportForceOverwrite Total coverage: 44.8% → 63.3% Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>