clone

push a directory of html from the terminal and get a four-character url back. a deno cli on cloudflare

fix(cli): keep numeric-looking site addresses as strings

Dami committed f32cca8
parseArgs coerced positionals such as 3e21 or 0123 into numbers, so
targeting those addresses failed or hit the wrong site.
commit
f32cca8e2663e3a5744f5c2d09a56dfa11b2bbc1
parent
ef5adede43b47c13771880d255fd49014ca1aab3
author
Dami <dami.etoile@gmail.com>
3 files changed, +64 -46
Acli/lib/args.ts54++++++++++++++++++++++++++++++
Mcli/main.ts48+--------------------------
Mcli/main_test.ts8++++
A cli/lib/args.ts +54 -0
M cli/main.ts +2 -46
@@ -16,7 +16,6 @@
1616 */1717 // nzip — push HTML and get a tiny URL back.1818 19-import { parseArgs } from "@std/cli/parse-args";2019 import { VERSION } from "@nzip/shared";2120 import { cmdAuth } from "./commands/auth.ts";2221 import { cmdApp } from "./commands/app.ts";
@@ -25,6 +24,7 @@ import { cmdSiteGroup } from "./commands/site.ts";
2524 import { cmdStatus } from "./commands/sites.ts";2625 import { cmdVault } from "./commands/vault.ts";2726 import { requireConfig } from "./lib/config.ts";27+import { parseCliArgs } from "./lib/args.ts";2828 import { fail, setJsonMode } from "./lib/fmt.ts";2929 3030 const HELP = `nzip — html share tool
@@ -91,51 +91,7 @@ passwords, tokens, private URLs, or sensitive personal data.
9191 * @throws If configuration, validation, or a command handler fails.9292 */9393 export async function main(argv = Deno.args): Promise<void> {94- const args = parseArgs(argv, {95- string: [96- "ttl",97- "to",98- "slot",99- "server",100- "token",101- "password",102- "name",103- "description",104- "default-ttl",105- "default-for",106- "framework",107- "output",108- "build-task",109- "title",110- "open",111- "tag",112- "root",113- "max-ttl",114- "default-password-file",115- "message",116- ],117- boolean: [118- "yes",119- "list",120- "help",121- "version",122- "no-password",123- "overwrite",124- "json",125- "no-description",126- "all",127- "no-default-for",128- "new",129- "require-password",130- "allow-unprotected",131- "no-default-password",132- "feedback",133- "no-feedback",134- "request",135- ],136- alias: { h: "help", V: "version", y: "yes" },137- collect: ["root"],138- });94+ const args = parseCliArgs(argv);13995 setJsonMode(args.json);14096 const [command, ...rest] = args._.map(String);14197
M cli/main_test.ts +8 -0