aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/cli.ts13
1 files changed, 10 insertions, 3 deletions
diff --git a/scripts/cli.ts b/scripts/cli.ts
index bbb9b4e..bf3e44a 100644
--- a/scripts/cli.ts
+++ b/scripts/cli.ts
@@ -1,14 +1,21 @@
-
const ws = new WebSocket(Deno.args[0])
-
-function do_stuff() {
+async function do_stuff() {
switch (Deno.args[1]) {
case "enqueue":
if (Deno.args.length >= 4)
ws.send(JSON.stringify({ t: "metadata", key: Deno.args[2], data: JSON.parse(Deno.args[3]) }))
ws.send(JSON.stringify({ t: "enqueue", key: Deno.args[2], ignore_complete: true }))
break;
+ // deno-lint-ignore no-case-declarations
+ case "enqueue_batch":
+ const a = await new Response(Deno.stdin.readable).text()
+ for (let key of a.split("\n")) {
+ key = key.trim()
+ if (!key) continue
+ ws.send(JSON.stringify({ t: "enqueue", key, ignore_complete: true }))
+ }
+ break;
case "retry_all":
ws.send(JSON.stringify({
t: "query",