taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 291502fd0e53624cc3839005a38f21cec8d5b7c1
parent e06249828d144dd4d6e7cad8e7e39f7ed93a87db
Author: Florian Dold <dold@taler.net>
Date:   Sat, 29 Aug 2026 00:10:14 +0200

wallet CLI: import and export database files

Diffstat:
Mpackages/taler-wallet-cli/src/index.ts | 42++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+), 0 deletions(-)

diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts @@ -3012,6 +3012,48 @@ backupCli.subcommand("importDb", "import-db").action(async (args) => { }); }); +backupCli + .subcommand("exportDbToFile", "export-db-to-file", { + help: "Export the wallet database to a file.", + }) + .requiredArgument("directory", clk.STRING, { + help: "Existing directory in which to create the backup.", + }) + .requiredArgument("stem", clk.STRING, { + help: "Backup filename without its format-specific extension.", + }) + .maybeOption("format", ["--format"], clk.STRING, { + help: "Backup format (json or sqlite3; defaults to sqlite3).", + }) + .action(async (args) => { + await withWallet(args, { lazyTaskLoop: true }, async (wallet) => { + const result = await wallet.client.call( + WalletApiOperation.ExportDbToFile, + { + directory: args.exportDbToFile.directory, + stem: args.exportDbToFile.stem, + forceFormat: args.exportDbToFile.format, + }, + ); + console.log(result.path); + }); + }); + +backupCli + .subcommand("importDbFromFile", "import-db-from-file", { + help: "Import a wallet database from a file, replacing existing data.", + }) + .requiredArgument("path", clk.STRING, { + help: "Path to the backup file to import.", + }) + .action(async (args) => { + await withWallet(args, { lazyTaskLoop: true }, async (wallet) => { + await wallet.client.call(WalletApiOperation.ImportDbFromFile, { + path: args.importDbFromFile.path, + }); + }); + }); + const bankAccountsCli = walletCli .subcommand("bankAccountArgs", "bank-accounts", { help: [