summaryrefslogtreecommitdiff
path: root/internal/cli/cli.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-07 15:41:44 +0200
committerPaul Buetow <paul@buetow.org>2026-03-07 15:41:44 +0200
commitfcbe17d60b7bf71e32a288db18d95e7f0948c2db (patch)
tree4443021dbb1a53c983d8ab0296734602a12391f4 /internal/cli/cli.go
parente353f20ac9ac8da0bc0cbcd7bb22838f765f47bc (diff)
Add KeePass migration command with text/password and binary attachment supportHEADmaster
Diffstat (limited to 'internal/cli/cli.go')
-rw-r--r--internal/cli/cli.go19
1 files changed, 14 insertions, 5 deletions
diff --git a/internal/cli/cli.go b/internal/cli/cli.go
index 11f1f7e..c8a271a 100644
--- a/internal/cli/cli.go
+++ b/internal/cli/cli.go
@@ -14,6 +14,7 @@ import (
"path/filepath"
"runtime"
"strings"
+ "time"
"codeberg.org/snonux/foostore/internal/clipboard"
"codeberg.org/snonux/foostore/internal/config"
@@ -29,7 +30,7 @@ import (
var CommandList = []string{
"ls", "search", "cat", "paste", "get", "add", "export", "pathexport",
"open", "edit", "import", "import_r", "rm", "sync", "status", "commit",
- "reset", "fullcommit", "shred", "version", "commands", "help", "shell",
+ "reset", "fullcommit", "shred", "migrate-kdbx", "version", "commands", "help", "shell",
"exit", "last",
}
@@ -55,6 +56,8 @@ type CLI struct {
g *git.Git
clip *clipboard.Clipboard
sh *shell.Shell
+ openKDBX func(string, string) (KDBXStore, error)
+ now func() time.Time
lastResult string // most recent search result description
}
@@ -100,10 +103,12 @@ func newCLI(ctx context.Context) (*CLI, error) {
clip := clipboard.New(cfg.GnomeClipboardCmd, cfg.MacOSClipboardCmd)
c := &CLI{
- cfg: &cfg,
- st: st,
- g: g,
- clip: clip,
+ cfg: &cfg,
+ st: st,
+ g: g,
+ clip: clip,
+ openKDBX: OpenKDBXStore,
+ now: time.Now,
}
// Create the shell with a completion function that references the CLI.
@@ -322,6 +327,9 @@ func (c *CLI) dispatchSimple(ctx context.Context, argv []string, cmd string) (in
}
return 0, "", true
+ case "migrate-kdbx":
+ return c.cmdMigrateKDBX(ctx, argv), "", true
+
case "version":
logMsg(fmt.Sprintf("foostore %s", version.Version))
return 0, "", true
@@ -681,6 +689,7 @@ import_r DIRECTORY [DEST_DIRECTORY]
rm SEARCHTERM
sync|status|commit|reset|fullcommit
shred
+migrate-kdbx [--db PATH] [--pass-file PATH] [--binary-out PATH] [--dry-run]
version
commands
help