diff options
Diffstat (limited to 'internal/cli/cli.go')
| -rw-r--r-- | internal/cli/cli.go | 19 |
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 |
