diff --git a/incr b/incr index 574a8c3..26bf924 100755 --- a/incr +++ b/incr @@ -2,10 +2,18 @@ // deno-lint-ignore-file prefer-const import { parseArgs } from "jsr:@std/cli"; -let db = await Deno.openKv("incrementer"); +let db = await Deno.openKv("~/.incr/incr.db"); if (import.meta.main) { - let args = parseArgs(Deno.args); + let args = parseArgs(Deno.args, {boolean: ["list"]}); + if (args["list"]) { + let iter = db.list({ prefix: [] }); + for await (const res of iter) { + console.log(`${res.key}: ${res.value}`); + } + Deno.exit(0); + } + let ns = args["_"][0] ?? "_global"; let old = await db.get([ns]);