diff options
| author | ivar <i@oiee.no> | 2026-03-09 23:05:38 +0100 |
|---|---|---|
| committer | ivar <i@oiee.no> | 2026-03-09 23:05:38 +0100 |
| commit | 69448e29a85cad3a94b3be3ad33efbc52764528f (patch) | |
| tree | c32b8c817322fdf26edbbb3fa75b9505a7020ae8 /cli/src/index.ts | |
| parent | b35302fa020ec82a9d67a6cb34379d42983d3cfc (diff) | |
| download | sparebank1-actualbudget-69448e29a85cad3a94b3be3ad33efbc52764528f.tar.xz sparebank1-actualbudget-69448e29a85cad3a94b3be3ad33efbc52764528f.zip | |
Diffstat (limited to 'cli/src/index.ts')
| -rw-r--r-- | cli/src/index.ts | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/cli/src/index.ts b/cli/src/index.ts new file mode 100644 index 0000000..daedaae --- /dev/null +++ b/cli/src/index.ts @@ -0,0 +1,39 @@ +#!/usr/bin/env tsx +import { auth } from "./commands/auth" +import { accounts } from "./commands/accounts" +import { runImport } from "./commands/import" +import { init } from "./commands/init" +import { backup, restore } from "./commands/backup" + +const [command, ...args] = process.argv.slice(2) + +const commands: Record<string, (args: string[]) => Promise<void>> = { + init: () => init(), + auth: () => auth(), + accounts: () => accounts(), + import: (args) => runImport(args), + backup: () => backup(), + restore: (args) => restore(args), +} + +const handler = commands[command] + +if (!handler) { + console.log("Usage: sb1-actual <command> [options]") + console.log("") + console.log("Commands:") + console.log(" init Create or edit config") + console.log(" auth Authenticate with Sparebanken 1 (opens browser)") + console.log(" accounts List accounts from SB1 and Actual, show mappings") + console.log(" import Import transactions into Actual") + console.log(" import --dry-run Preview import without writing") + console.log(" import --since=YYYY-MM-DD Only fetch transactions from this date") + console.log(" backup Export budget to ~/.config/sb1-actual/backups/") + console.log(" restore Restore budget from a backup") + process.exit(1) +} + +handler(args).catch(err => { + console.error(`Error: ${err.message}`) + process.exit(1) +}) |
