From 9c517a4411c6bf391dfbc14cfe0a486ba07effe6 Mon Sep 17 00:00:00 2001 From: lrapoport-cf Date: Fri, 11 Aug 2023 15:22:29 -0400 Subject: [PATCH] Clean up `wrangler --help` output This commit cleans up and standardizes the look and of all `wrangler` commands as displayed by `wrangler --help` and `wrangler --help`. --- .changeset/gorgeous-tomatoes-live.md | 7 + packages/wrangler/src/__tests__/ai.test.ts | 52 +- .../src/__tests__/cloudchamber/create.test.ts | 40 +- .../src/__tests__/cloudchamber/delete.test.ts | 26 +- .../src/__tests__/cloudchamber/images.test.ts | 28 +- .../src/__tests__/cloudchamber/list.test.ts | 38 +- .../src/__tests__/cloudchamber/modify.test.ts | 40 +- .../src/__tests__/constellation.test.ts | 62 +- packages/wrangler/src/__tests__/d1/d1.test.ts | 160 ++--- .../src/__tests__/deployments.test.ts | 30 +- packages/wrangler/src/__tests__/dev.test.tsx | 14 +- .../wrangler/src/__tests__/hyperdrive.test.ts | 74 +-- packages/wrangler/src/__tests__/index.test.ts | 260 ++++---- packages/wrangler/src/__tests__/kv.test.ts | 548 +++++++-------- .../src/__tests__/mtls-certificates.test.ts | 32 +- .../src/__tests__/pages/deploy.test.ts | 12 +- .../src/__tests__/pages/pages.test.ts | 32 +- .../wrangler/src/__tests__/pubsub.test.ts | 158 ++--- .../wrangler/src/__tests__/queues.test.ts | 296 ++++----- packages/wrangler/src/__tests__/r2.test.ts | 450 ++++++------- .../wrangler/src/__tests__/secret.test.ts | 16 +- .../src/__tests__/vectorize/vectorize.test.ts | 142 ++-- .../__tests__/versions/versions.help.test.ts | 206 +++--- .../src/__tests__/worker-namespace.test.ts | 152 ++--- packages/wrangler/src/d1/index.ts | 18 +- packages/wrangler/src/index.ts | 627 ++++++++++-------- packages/wrangler/src/kv/index.ts | 18 +- packages/wrangler/src/pages/index.ts | 14 +- .../wrangler/src/queues/cli/commands/index.ts | 2 +- packages/wrangler/src/secret/index.ts | 2 +- packages/wrangler/src/utils/stdout-styling.ts | 17 + .../src/versions/deployments/index.ts | 4 +- .../wrangler/src/versions/rollback/index.ts | 5 +- 33 files changed, 1830 insertions(+), 1752 deletions(-) create mode 100644 .changeset/gorgeous-tomatoes-live.md create mode 100644 packages/wrangler/src/utils/stdout-styling.ts diff --git a/.changeset/gorgeous-tomatoes-live.md b/.changeset/gorgeous-tomatoes-live.md new file mode 100644 index 000000000000..9f4e693d9c18 --- /dev/null +++ b/.changeset/gorgeous-tomatoes-live.md @@ -0,0 +1,7 @@ +--- +"wrangler": patch +--- + +chore: Cleanup `wrangler --help` output + +This commit cleans up and standardizes the look and feel of all `wrangler` commands as displayed by `wrangler --help` and `wrangler --help`. diff --git a/packages/wrangler/src/__tests__/ai.test.ts b/packages/wrangler/src/__tests__/ai.test.ts index 9ca818140bb0..485d3a5eb528 100644 --- a/packages/wrangler/src/__tests__/ai.test.ts +++ b/packages/wrangler/src/__tests__/ai.test.ts @@ -17,21 +17,22 @@ describe("ai help", () => { await endEventLoop(); expect(std.out).toMatchInlineSnapshot(` - "wrangler ai + "wrangler ai - ๐Ÿค– Interact with AI models + ๐Ÿค– Manage AI models - Commands: - wrangler ai models List catalog models - wrangler ai finetune Interact with finetune files - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + COMMANDS + wrangler ai models List catalog models + wrangler ai finetune Interact with finetune files + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); it("should show help when an invalid argument is passed", async () => { @@ -45,22 +46,23 @@ describe("ai help", () => { " `); expect(std.out).toMatchInlineSnapshot(` - " - wrangler ai + " + wrangler ai - ๐Ÿค– Interact with AI models + ๐Ÿค– Manage AI models - Commands: - wrangler ai models List catalog models - wrangler ai finetune Interact with finetune files - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + COMMANDS + wrangler ai models List catalog models + wrangler ai finetune Interact with finetune files + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); }); diff --git a/packages/wrangler/src/__tests__/cloudchamber/create.test.ts b/packages/wrangler/src/__tests__/cloudchamber/create.test.ts index a6d14324ccee..ecbbb232f7d2 100644 --- a/packages/wrangler/src/__tests__/cloudchamber/create.test.ts +++ b/packages/wrangler/src/__tests__/cloudchamber/create.test.ts @@ -27,29 +27,29 @@ describe("cloudchamber create", () => { await runWrangler("cloudchamber create --help"); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.out).toMatchInlineSnapshot(` - "wrangler cloudchamber create + "wrangler cloudchamber create - Create a new deployment + Create a new deployment - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] - Options: - --json Return output as clean JSON [boolean] [default: false] - --image Image to use for your deployment [string] - --location Location on Cloudflare's network where your deployment will run [string] - --var Container environment variables [array] - --label Deployment labels [array] - --all-ssh-keys To add all SSH keys configured on your account to be added to this deployment, set this option to true [boolean] - --ssh-key-id ID of the SSH key to add to the deployment [array] - --vcpu Number of vCPUs to allocate to this deployment. [number] - --memory Amount of memory (GB, MB...) to allocate to this deployment. Ex: 4GB. [string] - --ipv4 Include an IPv4 in the deployment [boolean]" - `); + OPTIONS + --json Return output as clean JSON [boolean] [default: false] + --image Image to use for your deployment [string] + --location Location on Cloudflare's network where your deployment will run [string] + --var Container environment variables [array] + --label Deployment labels [array] + --all-ssh-keys To add all SSH keys configured on your account to be added to this deployment, set this option to true [boolean] + --ssh-key-id ID of the SSH key to add to the deployment [array] + --vcpu Number of vCPUs to allocate to this deployment. [number] + --memory Amount of memory (GB, MB...) to allocate to this deployment. Ex: 4GB. [string] + --ipv4 Include an IPv4 in the deployment [boolean]" + `); }); it("should create deployment (detects no interactivity)", async () => { diff --git a/packages/wrangler/src/__tests__/cloudchamber/delete.test.ts b/packages/wrangler/src/__tests__/cloudchamber/delete.test.ts index 6c37270ac15c..4473504aaebe 100644 --- a/packages/wrangler/src/__tests__/cloudchamber/delete.test.ts +++ b/packages/wrangler/src/__tests__/cloudchamber/delete.test.ts @@ -27,23 +27,23 @@ describe("cloudchamber delete", () => { await runWrangler("cloudchamber delete --help"); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.out).toMatchInlineSnapshot(` - "wrangler cloudchamber delete [deploymentId] + "wrangler cloudchamber delete [deploymentId] - Delete an existing deployment that is running in the Cloudflare edge + Delete an existing deployment that is running in the Cloudflare edge - Positionals: - deploymentId deployment you want to delete [string] + POSITIONALS + deploymentId deployment you want to delete [string] - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] - Options: - --json Return output as clean JSON [boolean] [default: false]" - `); + OPTIONS + --json Return output as clean JSON [boolean] [default: false]" + `); }); it("should delete deployment (detects no interactivity)", async () => { diff --git a/packages/wrangler/src/__tests__/cloudchamber/images.test.ts b/packages/wrangler/src/__tests__/cloudchamber/images.test.ts index 657862929ffa..a1b60c51d894 100644 --- a/packages/wrangler/src/__tests__/cloudchamber/images.test.ts +++ b/packages/wrangler/src/__tests__/cloudchamber/images.test.ts @@ -25,24 +25,24 @@ describe("cloudchamber image", () => { await runWrangler("cloudchamber registries --help"); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.out).toMatchInlineSnapshot(` - "wrangler cloudchamber registries + "wrangler cloudchamber registries - Configure registries via Cloudchamber + Configure registries via Cloudchamber - Commands: - wrangler cloudchamber registries configure Configure Cloudchamber to pull from specific registries - wrangler cloudchamber registries credentials [domain] get a temporary password for a specific domain + COMMANDS + wrangler cloudchamber registries configure Configure Cloudchamber to pull from specific registries + wrangler cloudchamber registries credentials [domain] get a temporary password for a specific domain - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] - Options: - --json Return output as clean JSON [boolean] [default: false]" - `); + OPTIONS + --json Return output as clean JSON [boolean] [default: false]" + `); }); it("should create an image registry (no interactivity)", async () => { diff --git a/packages/wrangler/src/__tests__/cloudchamber/list.test.ts b/packages/wrangler/src/__tests__/cloudchamber/list.test.ts index cf572d84c3a3..cd5df1bf813d 100644 --- a/packages/wrangler/src/__tests__/cloudchamber/list.test.ts +++ b/packages/wrangler/src/__tests__/cloudchamber/list.test.ts @@ -27,29 +27,29 @@ describe("cloudchamber list", () => { await runWrangler("cloudchamber list --help"); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.out).toMatchInlineSnapshot(` - "wrangler cloudchamber list [deploymentIdPrefix] + "wrangler cloudchamber list [deploymentIdPrefix] - List and view status of deployments + List and view status of deployments - Positionals: - deploymentIdPrefix Optional deploymentId to filter deployments - This means that 'list' will only showcase deployments that contain this ID prefix [string] + POSITIONALS + deploymentIdPrefix Optional deploymentId to filter deployments + This means that 'list' will only showcase deployments that contain this ID prefix [string] - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] - Options: - --json Return output as clean JSON [boolean] [default: false] - --location Filter deployments by location [string] - --image Filter deployments by image [string] - --state Filter deployments by deployment state [string] - --ipv4 Filter deployments by ipv4 address [string] - --label Filter deployments by labels [array]" - `); + OPTIONS + --json Return output as clean JSON [boolean] [default: false] + --location Filter deployments by location [string] + --image Filter deployments by image [string] + --state Filter deployments by deployment state [string] + --ipv4 Filter deployments by ipv4 address [string] + --label Filter deployments by labels [array]" + `); }); it("should list deployments (json)", async () => { diff --git a/packages/wrangler/src/__tests__/cloudchamber/modify.test.ts b/packages/wrangler/src/__tests__/cloudchamber/modify.test.ts index a5f4e08ea824..619d465b27f6 100644 --- a/packages/wrangler/src/__tests__/cloudchamber/modify.test.ts +++ b/packages/wrangler/src/__tests__/cloudchamber/modify.test.ts @@ -26,30 +26,30 @@ describe("cloudchamber modify", () => { await runWrangler("cloudchamber modify --help"); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.out).toMatchInlineSnapshot(` - "wrangler cloudchamber modify [deploymentId] + "wrangler cloudchamber modify [deploymentId] - Modify an existing deployment + Modify an existing deployment - Positionals: - deploymentId The deployment you want to modify [string] + POSITIONALS + deploymentId The deployment you want to modify [string] - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] - Options: - --json Return output as clean JSON [boolean] [default: false] - --var Container environment variables [array] - --label Deployment labels [array] - --ssh-public-key-id Public SSH key IDs to include in this container. You can add one to your account with \`wrangler cloudchamber ssh create [array] - --image The new image that the deployment will have from now on [string] - --location The new location that the deployment will have from now on [string] - --vcpu The new vcpu that the deployment will have from now on [number] - --memory The new memory that the deployment will have from now on [string]" - `); + OPTIONS + --json Return output as clean JSON [boolean] [default: false] + --var Container environment variables [array] + --label Deployment labels [array] + --ssh-public-key-id Public SSH key IDs to include in this container. You can add one to your account with \`wrangler cloudchamber ssh create [array] + --image The new image that the deployment will have from now on [string] + --location The new location that the deployment will have from now on [string] + --vcpu The new vcpu that the deployment will have from now on [number] + --memory The new memory that the deployment will have from now on [string]" + `); }); it("should modify deployment (detects no interactivity)", async () => { diff --git a/packages/wrangler/src/__tests__/constellation.test.ts b/packages/wrangler/src/__tests__/constellation.test.ts index 8e8182344780..b084ff3b99ea 100644 --- a/packages/wrangler/src/__tests__/constellation.test.ts +++ b/packages/wrangler/src/__tests__/constellation.test.ts @@ -19,21 +19,21 @@ describe("constellation help", () => { await endEventLoop(); expect(std.out).toMatchInlineSnapshot(` - "wrangler constellation - - Commands: - wrangler constellation project Manage your projects - wrangler constellation model Manage your models - wrangler constellation catalog Check the curated model catalog - wrangler constellation runtime Check the suported runtimes - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + "wrangler constellation + + COMMANDS + wrangler constellation project Manage your projects + wrangler constellation model Manage your models + wrangler constellation catalog Check the curated model catalog + wrangler constellation runtime Check the suported runtimes + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); it("should show help when an invalid argument is passed", async () => { @@ -47,22 +47,22 @@ describe("constellation help", () => { " `); expect(std.out).toMatchInlineSnapshot(` - " - wrangler constellation - - Commands: - wrangler constellation project Manage your projects - wrangler constellation model Manage your models - wrangler constellation catalog Check the curated model catalog - wrangler constellation runtime Check the suported runtimes - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + " + wrangler constellation + + COMMANDS + wrangler constellation project Manage your projects + wrangler constellation model Manage your models + wrangler constellation catalog Check the curated model catalog + wrangler constellation runtime Check the suported runtimes + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); }); diff --git a/packages/wrangler/src/__tests__/d1/d1.test.ts b/packages/wrangler/src/__tests__/d1/d1.test.ts index 51fe0a409a04..73f71d424330 100644 --- a/packages/wrangler/src/__tests__/d1/d1.test.ts +++ b/packages/wrangler/src/__tests__/d1/d1.test.ts @@ -12,29 +12,29 @@ describe("d1", () => { await endEventLoop(); expect(std.out).toMatchInlineSnapshot(` - "wrangler d1 - - ๐Ÿ—„ Interact with a D1 database - - Commands: - wrangler d1 list List D1 databases - wrangler d1 info Get information about a D1 database, including the current database size and state. - wrangler d1 insights Experimental command. Get information about the queries run on a D1 database. - wrangler d1 create Create D1 database - wrangler d1 delete Delete D1 database - wrangler d1 backup Interact with D1 Backups - wrangler d1 execute Executed command or SQL file - wrangler d1 export Export the contents or schema of your database as a .sql file - wrangler d1 time-travel Use Time Travel to restore, fork or copy a database at a specific point-in-time. - wrangler d1 migrations Interact with D1 Migrations - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + "wrangler d1 + + ๐Ÿ—„ Manage Workers D1 databases + + COMMANDS + wrangler d1 list List D1 databases + wrangler d1 info Get information about a D1 database, including the current database size and state + wrangler d1 insights Experimental command. Get information about the queries run on a D1 database. + wrangler d1 create Create D1 database + wrangler d1 delete Delete D1 database + wrangler d1 backup Interact with D1 backups + wrangler d1 execute Execute a command or SQL file + wrangler d1 export Export the contents or schema of your database as a .sql file + wrangler d1 time-travel Use Time Travel to restore, fork or copy a database at a specific point-in-time + wrangler d1 migrations Interact with D1 migrations + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); it("should show help when an invalid argument is passed", async () => { @@ -48,30 +48,30 @@ describe("d1", () => { " `); expect(std.out).toMatchInlineSnapshot(` - " - wrangler d1 - - ๐Ÿ—„ Interact with a D1 database - - Commands: - wrangler d1 list List D1 databases - wrangler d1 info Get information about a D1 database, including the current database size and state. - wrangler d1 insights Experimental command. Get information about the queries run on a D1 database. - wrangler d1 create Create D1 database - wrangler d1 delete Delete D1 database - wrangler d1 backup Interact with D1 Backups - wrangler d1 execute Executed command or SQL file - wrangler d1 export Export the contents or schema of your database as a .sql file - wrangler d1 time-travel Use Time Travel to restore, fork or copy a database at a specific point-in-time. - wrangler d1 migrations Interact with D1 Migrations - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + " + wrangler d1 + + ๐Ÿ—„ Manage Workers D1 databases + + COMMANDS + wrangler d1 list List D1 databases + wrangler d1 info Get information about a D1 database, including the current database size and state + wrangler d1 insights Experimental command. Get information about the queries run on a D1 database. + wrangler d1 create Create D1 database + wrangler d1 delete Delete D1 database + wrangler d1 backup Interact with D1 backups + wrangler d1 execute Execute a command or SQL file + wrangler d1 export Export the contents or schema of your database as a .sql file + wrangler d1 time-travel Use Time Travel to restore, fork or copy a database at a specific point-in-time + wrangler d1 migrations Interact with D1 migrations + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); it("should show help when the migrations command is passed", async () => { @@ -85,23 +85,23 @@ describe("d1", () => { " `); expect(std.out).toMatchInlineSnapshot(` - " - wrangler d1 migrations - - Interact with D1 Migrations - - Commands: - wrangler d1 migrations list List your D1 migrations - wrangler d1 migrations create Create a new Migration - wrangler d1 migrations apply Apply D1 Migrations - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + " + wrangler d1 migrations + + Interact with D1 migrations + + COMMANDS + wrangler d1 migrations list List your D1 migrations + wrangler d1 migrations create Create a new migration + wrangler d1 migrations apply Apply D1 migrations + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); it("should show help when the time travel command is passed", async () => { @@ -115,21 +115,21 @@ describe("d1", () => { " `); expect(std.out).toMatchInlineSnapshot(` - " - wrangler d1 time-travel - - Use Time Travel to restore, fork or copy a database at a specific point-in-time. - - Commands: - wrangler d1 time-travel info Retrieve information about a database at a specific point-in-time using Time Travel. - wrangler d1 time-travel restore Restore a database back to a specific point-in-time. - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + " + wrangler d1 time-travel + + Use Time Travel to restore, fork or copy a database at a specific point-in-time + + COMMANDS + wrangler d1 time-travel info Retrieve information about a database at a specific point-in-time using Time Travel + wrangler d1 time-travel restore Restore a database back to a specific point-in-time + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); }); diff --git a/packages/wrangler/src/__tests__/deployments.test.ts b/packages/wrangler/src/__tests__/deployments.test.ts index 82f6b842336b..7c84e224a6a4 100644 --- a/packages/wrangler/src/__tests__/deployments.test.ts +++ b/packages/wrangler/src/__tests__/deployments.test.ts @@ -55,26 +55,26 @@ describe("deployments", () => { it("should log a help message for deployments command", async () => { await runWrangler("deployments --help"); expect(std.out).toMatchInlineSnapshot(` - "wrangler deployments + "wrangler deployments - ๐Ÿšข List and view details for deployments + ๐Ÿšข List and view the current and past deployments for your Worker [open beta] - Commands: - wrangler deployments list ๐Ÿšข Displays the 10 most recent deployments for a worker - wrangler deployments view [deployment-id] ๐Ÿ” View a deployment + COMMANDS + wrangler deployments list Displays the 10 most recent deployments for a Worker + wrangler deployments view [deployment-id] View a deployment - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] - Options: - --name The name of your worker [string] + OPTIONS + --name The name of your Worker [string] - ๐Ÿšง\`wrangler deployments\` is a beta command. Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose" - `); + ๐Ÿšง\`wrangler deployments\` is a beta command. Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose" + `); }); describe("deployments subcommands", () => { diff --git a/packages/wrangler/src/__tests__/dev.test.tsx b/packages/wrangler/src/__tests__/dev.test.tsx index 225a3d9b7601..20452d820caa 100644 --- a/packages/wrangler/src/__tests__/dev.test.tsx +++ b/packages/wrangler/src/__tests__/dev.test.tsx @@ -1191,17 +1191,17 @@ describe("wrangler dev", () => { "out": " wrangler dev [script] - ๐Ÿ‘‚ Start a local server for developing your worker + Start a local server for developing a worker Positionals: script The path to an entry point for your worker [string] - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] + Global Flags: + -j, --experimental-json-config โš‘Experimental: support wrangler.json [boolean] + -c, --config โš‘Path to .toml configuration file [string] + -e, --env โš‘Environment to use for operations and .env files [string] + -h, --help โš‘Show help [boolean] + -v, --version โš‘Show version number [boolean] Options: --name Name of the worker [string] diff --git a/packages/wrangler/src/__tests__/hyperdrive.test.ts b/packages/wrangler/src/__tests__/hyperdrive.test.ts index 72e6d6d48353..c6710908b419 100644 --- a/packages/wrangler/src/__tests__/hyperdrive.test.ts +++ b/packages/wrangler/src/__tests__/hyperdrive.test.ts @@ -20,24 +20,24 @@ describe("hyperdrive help", () => { expect(std.err).toMatchInlineSnapshot(`""`); expect(std.out).toMatchInlineSnapshot(` - "wrangler hyperdrive - - ๐Ÿš€ Configure Hyperdrive databases - - Commands: - wrangler hyperdrive create Create a Hyperdrive config - wrangler hyperdrive delete Delete a Hyperdrive config - wrangler hyperdrive get Get a Hyperdrive config - wrangler hyperdrive list List Hyperdrive configs - wrangler hyperdrive update Update a Hyperdrive config - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + "wrangler hyperdrive + + ๐Ÿš€ Manage Hyperdrive databases + + COMMANDS + wrangler hyperdrive create Create a Hyperdrive config + wrangler hyperdrive delete Delete a Hyperdrive config + wrangler hyperdrive get Get a Hyperdrive config + wrangler hyperdrive list List Hyperdrive configs + wrangler hyperdrive update Update a Hyperdrive config + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); it("should show help when an invalid argument is pased", async () => { @@ -51,25 +51,25 @@ describe("hyperdrive help", () => { " `); expect(std.out).toMatchInlineSnapshot(` - " - wrangler hyperdrive - - ๐Ÿš€ Configure Hyperdrive databases - - Commands: - wrangler hyperdrive create Create a Hyperdrive config - wrangler hyperdrive delete Delete a Hyperdrive config - wrangler hyperdrive get Get a Hyperdrive config - wrangler hyperdrive list List Hyperdrive configs - wrangler hyperdrive update Update a Hyperdrive config - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + " + wrangler hyperdrive + + ๐Ÿš€ Manage Hyperdrive databases + + COMMANDS + wrangler hyperdrive create Create a Hyperdrive config + wrangler hyperdrive delete Delete a Hyperdrive config + wrangler hyperdrive get Get a Hyperdrive config + wrangler hyperdrive list List Hyperdrive configs + wrangler hyperdrive update Update a Hyperdrive config + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); }); diff --git a/packages/wrangler/src/__tests__/index.test.ts b/packages/wrangler/src/__tests__/index.test.ts index 6e4dfe164036..5adac154e049 100644 --- a/packages/wrangler/src/__tests__/index.test.ts +++ b/packages/wrangler/src/__tests__/index.test.ts @@ -35,39 +35,43 @@ describe("wrangler", () => { expect(std.out).toMatchInlineSnapshot(` "wrangler - Commands: - wrangler docs [command..] ๐Ÿ“š Open wrangler's docs in your browser - wrangler init [name] ๐Ÿ“ฅ Initialize a basic Worker project, including a wrangler.toml file - wrangler generate [name] [template] โœจ Generate a new Worker project from an existing Worker template. See https://github.com/cloudflare/workers-sdk/tree/main/templates - wrangler dev [script] ๐Ÿ‘‚ Start a local server for developing your worker - wrangler deploy [script] ๐Ÿ†™ Deploy your Worker to Cloudflare. [aliases: publish] - wrangler delete [script] ๐Ÿ—‘ Delete your Worker from Cloudflare. - wrangler tail [worker] ๐Ÿฆš Starts a log tailing session for a published Worker. - wrangler secret ๐Ÿคซ Generate a secret that can be referenced in a Worker - wrangler kv ๐Ÿ—‚๏ธ Interact with your Workers KV Namespaces - wrangler pages โšก๏ธ Configure Cloudflare Pages - wrangler queues ๐Ÿ‡ถ Configure Workers Queues - wrangler r2 ๐Ÿ“ฆ Interact with an R2 store - wrangler dispatch-namespace ๐Ÿ“ฆ Interact with a dispatch namespace - wrangler d1 ๐Ÿ—„ Interact with a D1 database - wrangler hyperdrive ๐Ÿš€ Configure Hyperdrive databases - wrangler ai ๐Ÿค– Interact with AI models - wrangler vectorize ๐Ÿงฎ Interact with Vectorize indexes - wrangler pubsub ๐Ÿ“ฎ Interact and manage Pub/Sub Brokers - wrangler mtls-certificate ๐Ÿชช Manage certificates used for mTLS connections - wrangler login ๐Ÿ”“ Login to Cloudflare - wrangler logout ๐Ÿšช Logout from Cloudflare - wrangler whoami ๐Ÿ•ต๏ธ Retrieve your user info and test your auth config - wrangler types [path] ๐Ÿ“ Generate types from bindings & module rules in config - wrangler deployments ๐Ÿšข List and view details for deployments - wrangler rollback [deployment-id] ๐Ÿ”™ Rollback a deployment - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" + COMMANDS + wrangler docs [command] ๐Ÿ“š Open the wrangler commands documentation in your browser + + wrangler init [name] ๐Ÿ“ฅ Initialize a basic Worker application + wrangler dev [script] ๐Ÿ‘‚ Start a local server for developing a Worker + wrangler deploy [script] ๐Ÿ†™ Deploy a Worker to Cloudflare [aliases: publish] + wrangler deployments ๐Ÿšข List and view the current and past deployments for your Worker [open beta] + wrangler rollback [deployment-id] ๐Ÿ”™ Rollback a deployment for a Worker [open beta] + wrangler delete [script] ๐Ÿ—‘ Delete a Worker from Cloudflare + wrangler tail [worker] ๐Ÿฆš Start a log tailing session for a Worker + wrangler secret ๐Ÿคซ Generate a secret that can be referenced in a Worker + wrangler types [path] ๐Ÿ“ Generate types from bindings and module rules in configuration + + wrangler kv ๐Ÿ—‚๏ธ Manage Workers KV Namespaces + wrangler queues ๐Ÿ‡ถ Manage Workers Queues + wrangler r2 ๐Ÿ“ฆ Manage R2 buckets & objects + wrangler d1 ๐Ÿ—„ Manage Workers D1 databases + wrangler vectorize ๐Ÿงฎ Manage Vectorize indexes [open beta] + wrangler hyperdrive ๐Ÿš€ Manage Hyperdrive databases + wrangler pages โšก๏ธ Configure Cloudflare Pages + wrangler mtls-certificate ๐Ÿชช Manage certificates used for mTLS connections + wrangler pubsub ๐Ÿ“ฎ Manage Pub/Sub brokers [private beta] + wrangler dispatch-namespace ๐Ÿ—๏ธ Manage dispatch namespaces + wrangler ai ๐Ÿค– Manage AI models + + wrangler login ๐Ÿ”“ Login to Cloudflare + wrangler logout ๐Ÿšช Logout from Cloudflare + wrangler whoami ๐Ÿ•ต๏ธ Retrieve your user information and test your authentication configuration + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] + + Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose" `); expect(std.err).toMatchInlineSnapshot(`""`); @@ -86,39 +90,43 @@ describe("wrangler", () => { " wrangler - Commands: - wrangler docs [command..] ๐Ÿ“š Open wrangler's docs in your browser - wrangler init [name] ๐Ÿ“ฅ Initialize a basic Worker project, including a wrangler.toml file - wrangler generate [name] [template] โœจ Generate a new Worker project from an existing Worker template. See https://github.com/cloudflare/workers-sdk/tree/main/templates - wrangler dev [script] ๐Ÿ‘‚ Start a local server for developing your worker - wrangler deploy [script] ๐Ÿ†™ Deploy your Worker to Cloudflare. [aliases: publish] - wrangler delete [script] ๐Ÿ—‘ Delete your Worker from Cloudflare. - wrangler tail [worker] ๐Ÿฆš Starts a log tailing session for a published Worker. - wrangler secret ๐Ÿคซ Generate a secret that can be referenced in a Worker - wrangler kv ๐Ÿ—‚๏ธ Interact with your Workers KV Namespaces - wrangler pages โšก๏ธ Configure Cloudflare Pages - wrangler queues ๐Ÿ‡ถ Configure Workers Queues - wrangler r2 ๐Ÿ“ฆ Interact with an R2 store - wrangler dispatch-namespace ๐Ÿ“ฆ Interact with a dispatch namespace - wrangler d1 ๐Ÿ—„ Interact with a D1 database - wrangler hyperdrive ๐Ÿš€ Configure Hyperdrive databases - wrangler ai ๐Ÿค– Interact with AI models - wrangler vectorize ๐Ÿงฎ Interact with Vectorize indexes - wrangler pubsub ๐Ÿ“ฎ Interact and manage Pub/Sub Brokers - wrangler mtls-certificate ๐Ÿชช Manage certificates used for mTLS connections - wrangler login ๐Ÿ”“ Login to Cloudflare - wrangler logout ๐Ÿšช Logout from Cloudflare - wrangler whoami ๐Ÿ•ต๏ธ Retrieve your user info and test your auth config - wrangler types [path] ๐Ÿ“ Generate types from bindings & module rules in config - wrangler deployments ๐Ÿšข List and view details for deployments - wrangler rollback [deployment-id] ๐Ÿ”™ Rollback a deployment - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" + COMMANDS + wrangler docs [command] ๐Ÿ“š Open the wrangler commands documentation in your browser + + wrangler init [name] ๐Ÿ“ฅ Initialize a basic Worker application + wrangler dev [script] ๐Ÿ‘‚ Start a local server for developing a Worker + wrangler deploy [script] ๐Ÿ†™ Deploy a Worker to Cloudflare [aliases: publish] + wrangler deployments ๐Ÿšข List and view the current and past deployments for your Worker [open beta] + wrangler rollback [deployment-id] ๐Ÿ”™ Rollback a deployment for a Worker [open beta] + wrangler delete [script] ๐Ÿ—‘ Delete a Worker from Cloudflare + wrangler tail [worker] ๐Ÿฆš Start a log tailing session for a Worker + wrangler secret ๐Ÿคซ Generate a secret that can be referenced in a Worker + wrangler types [path] ๐Ÿ“ Generate types from bindings and module rules in configuration + + wrangler kv ๐Ÿ—‚๏ธ Manage Workers KV Namespaces + wrangler queues ๐Ÿ‡ถ Manage Workers Queues + wrangler r2 ๐Ÿ“ฆ Manage R2 buckets & objects + wrangler d1 ๐Ÿ—„ Manage Workers D1 databases + wrangler vectorize ๐Ÿงฎ Manage Vectorize indexes [open beta] + wrangler hyperdrive ๐Ÿš€ Manage Hyperdrive databases + wrangler pages โšก๏ธ Configure Cloudflare Pages + wrangler mtls-certificate ๐Ÿชช Manage certificates used for mTLS connections + wrangler pubsub ๐Ÿ“ฎ Manage Pub/Sub brokers [private beta] + wrangler dispatch-namespace ๐Ÿ—๏ธ Manage dispatch namespaces + wrangler ai ๐Ÿค– Manage AI models + + wrangler login ๐Ÿ”“ Login to Cloudflare + wrangler logout ๐Ÿšช Logout from Cloudflare + wrangler whoami ๐Ÿ•ต๏ธ Retrieve your user information and test your authentication configuration + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] + + Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose" `); expect(std.err).toMatchInlineSnapshot(` "X [ERROR] Unknown argument: invalid-command @@ -152,23 +160,23 @@ describe("wrangler", () => { await runWrangler("secret"); await endEventLoop(); expect(std.out).toMatchInlineSnapshot(` - "wrangler secret - - ๐Ÿคซ Generate a secret that can be referenced in a Worker - - Commands: - wrangler secret put Create or update a secret variable for a Worker - wrangler secret delete Delete a secret variable from a Worker - wrangler secret list List all secrets for a Worker - wrangler secret bulk [json] ๐Ÿ—„๏ธ Bulk upload secrets for a Worker - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + "wrangler secret + + ๐Ÿคซ Generate a secret that can be referenced in a Worker + + COMMANDS + wrangler secret put Create or update a secret variable for a Worker + wrangler secret delete Delete a secret variable from a Worker + wrangler secret list List all secrets for a Worker + wrangler secret bulk [json] Bulk upload secrets for a Worker + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); it("no subcommand 'kv namespace' should display a list of available subcommands", async () => { @@ -177,19 +185,19 @@ describe("wrangler", () => { expect(std.out).toMatchInlineSnapshot(` "wrangler kv namespace - ๐Ÿ—‚๏ธ Interact with your Workers KV Namespaces + Interact with your Workers KV Namespaces - Commands: + COMMANDS wrangler kv namespace create Create a new namespace - wrangler kv namespace list Outputs a list of all KV namespaces associated with your account id. - wrangler kv namespace delete Deletes a given namespace. - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" + wrangler kv namespace list Output a list of all KV namespaces associated with your account id + wrangler kv namespace delete Delete a given namespace. + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" `); }); @@ -199,20 +207,20 @@ describe("wrangler", () => { expect(std.out).toMatchInlineSnapshot(` "wrangler kv key - ๐Ÿ”‘ Individually manage Workers KV key-value pairs + Individually manage Workers KV key-value pairs - Commands: - wrangler kv key put [value] Writes a single key/value pair to the given namespace. - wrangler kv key list Outputs a list of all keys in a given namespace. - wrangler kv key get Reads a single value by key from the given namespace. - wrangler kv key delete Removes a single key value pair from the given namespace. + COMMANDS + wrangler kv key put [value] Write a single key/value pair to the given namespace + wrangler kv key list Output a list of all keys in a given namespace + wrangler kv key get Read a single value by key from the given namespace + wrangler kv key delete Remove a single key value pair from the given namespace - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" `); }); @@ -222,18 +230,18 @@ describe("wrangler", () => { expect(std.out).toMatchInlineSnapshot(` "wrangler kv bulk - ๐Ÿ’ช Interact with multiple Workers KV key-value pairs at once + Interact with multiple Workers KV key-value pairs at once - Commands: + COMMANDS wrangler kv bulk put Upload multiple key-value pairs to a namespace wrangler kv bulk delete Delete multiple key-value pairs from a namespace - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" `); }); @@ -241,21 +249,21 @@ describe("wrangler", () => { await runWrangler("r2"); await endEventLoop(); expect(std.out).toMatchInlineSnapshot(` - "wrangler r2 + "wrangler r2 - ๐Ÿ“ฆ Interact with an R2 store + ๐Ÿ“ฆ Manage R2 buckets & objects - Commands: - wrangler r2 object Manage R2 objects - wrangler r2 bucket Manage R2 buckets + COMMANDS + wrangler r2 object Manage R2 objects + wrangler r2 bucket Manage R2 buckets - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); }); diff --git a/packages/wrangler/src/__tests__/kv.test.ts b/packages/wrangler/src/__tests__/kv.test.ts index f77313310d92..4b6c6bea2a8b 100644 --- a/packages/wrangler/src/__tests__/kv.test.ts +++ b/packages/wrangler/src/__tests__/kv.test.ts @@ -37,19 +37,19 @@ describe("wrangler", () => { expect(std.out).toMatchInlineSnapshot(` "wrangler kv - ๐Ÿ—‚๏ธ Interact with your Workers KV Namespaces - - Commands: - wrangler kv namespace ๐Ÿ—‚๏ธ Interact with your Workers KV Namespaces - wrangler kv key ๐Ÿ”‘ Individually manage Workers KV key-value pairs - wrangler kv bulk ๐Ÿ’ช Interact with multiple Workers KV key-value pairs at once - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" + ๐Ÿ—‚๏ธ Manage Workers KV Namespaces + + COMMANDS + wrangler kv namespace Interact with your Workers KV Namespaces + wrangler kv key Individually manage Workers KV key-value pairs + wrangler kv bulk Interact with multiple Workers KV key-value pairs at once + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" `); }); @@ -81,24 +81,24 @@ describe("wrangler", () => { `[Error: Not enough non-option arguments: got 0, need at least 1]` ); expect(std.out).toMatchInlineSnapshot(` - " - wrangler kv namespace create + " + wrangler kv namespace create - Create a new namespace + Create a new namespace - Positionals: - namespace The name of the new namespace [string] [required] + POSITIONALS + namespace The name of the new namespace [string] [required] - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] - Options: - --preview Interact with a preview namespace [boolean]" - `); + OPTIONS + --preview Interact with a preview namespace [boolean]" + `); expect(std.err).toMatchInlineSnapshot(` "X [ERROR] Not enough non-option arguments: got 0, need at least 1 @@ -113,24 +113,24 @@ describe("wrangler", () => { `[Error: Unknown arguments: def, ghi]` ); expect(std.out).toMatchInlineSnapshot(` - " - wrangler kv namespace create + " + wrangler kv namespace create - Create a new namespace + Create a new namespace - Positionals: - namespace The name of the new namespace [string] [required] + POSITIONALS + namespace The name of the new namespace [string] [required] - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] - Options: - --preview Interact with a preview namespace [boolean]" - `); + OPTIONS + --preview Interact with a preview namespace [boolean]" + `); expect(std.err).toMatchInlineSnapshot(` "X [ERROR] Unknown arguments: def, ghi @@ -574,33 +574,33 @@ describe("wrangler", () => { ); expect(std.out).toMatchInlineSnapshot(` - " - wrangler kv key put [value] - - Writes a single key/value pair to the given namespace. - - Positionals: - key The key to write to [string] [required] - value The value to write [string] - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] - - Options: - --binding The binding of the namespace to write to [string] - --namespace-id The id of the namespace to write to [string] - --preview Interact with a preview namespace [boolean] - --ttl Time for which the entries should be visible [number] - --expiration Time since the UNIX epoch after which the entry expires [number] - --metadata Arbitrary JSON that is associated with a key [string] - --path Read value from the file at a given path [string] - --local Interact with local storage [boolean] - --persist-to Directory for local persistence [string]" - `); + " + wrangler kv key put [value] + + Write a single key/value pair to the given namespace + + POSITIONALS + key The key to write to [string] [required] + value The value to write [string] + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] + + OPTIONS + --binding The binding of the namespace to write to [string] + --namespace-id The id of the namespace to write to [string] + --preview Interact with a preview namespace [boolean] + --ttl Time for which the entries should be visible [number] + --expiration Time since the UNIX epoch after which the entry expires [number] + --metadata Arbitrary JSON that is associated with a key [string] + --path Read value from the file at a given path [string] + --local Interact with local storage [boolean] + --persist-to Directory for local persistence [string]" + `); expect(std.err).toMatchInlineSnapshot(` "X [ERROR] Not enough non-option arguments: got 0, need at least 1 @@ -616,33 +616,33 @@ describe("wrangler", () => { ); expect(std.out).toMatchInlineSnapshot(` - " - wrangler kv key put [value] - - Writes a single key/value pair to the given namespace. - - Positionals: - key The key to write to [string] [required] - value The value to write [string] - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] - - Options: - --binding The binding of the namespace to write to [string] - --namespace-id The id of the namespace to write to [string] - --preview Interact with a preview namespace [boolean] - --ttl Time for which the entries should be visible [number] - --expiration Time since the UNIX epoch after which the entry expires [number] - --metadata Arbitrary JSON that is associated with a key [string] - --path Read value from the file at a given path [string] - --local Interact with local storage [boolean] - --persist-to Directory for local persistence [string]" - `); + " + wrangler kv key put [value] + + Write a single key/value pair to the given namespace + + POSITIONALS + key The key to write to [string] [required] + value The value to write [string] + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] + + OPTIONS + --binding The binding of the namespace to write to [string] + --namespace-id The id of the namespace to write to [string] + --preview Interact with a preview namespace [boolean] + --ttl Time for which the entries should be visible [number] + --expiration Time since the UNIX epoch after which the entry expires [number] + --metadata Arbitrary JSON that is associated with a key [string] + --path Read value from the file at a given path [string] + --local Interact with local storage [boolean] + --persist-to Directory for local persistence [string]" + `); expect(std.err).toMatchInlineSnapshot(` "X [ERROR] Exactly one of the arguments binding and namespace-id is required @@ -658,33 +658,33 @@ describe("wrangler", () => { ); expect(std.out).toMatchInlineSnapshot(` - " - wrangler kv key put [value] - - Writes a single key/value pair to the given namespace. - - Positionals: - key The key to write to [string] [required] - value The value to write [string] - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] - - Options: - --binding The binding of the namespace to write to [string] - --namespace-id The id of the namespace to write to [string] - --preview Interact with a preview namespace [boolean] - --ttl Time for which the entries should be visible [number] - --expiration Time since the UNIX epoch after which the entry expires [number] - --metadata Arbitrary JSON that is associated with a key [string] - --path Read value from the file at a given path [string] - --local Interact with local storage [boolean] - --persist-to Directory for local persistence [string]" - `); + " + wrangler kv key put [value] + + Write a single key/value pair to the given namespace + + POSITIONALS + key The key to write to [string] [required] + value The value to write [string] + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] + + OPTIONS + --binding The binding of the namespace to write to [string] + --namespace-id The id of the namespace to write to [string] + --preview Interact with a preview namespace [boolean] + --ttl Time for which the entries should be visible [number] + --expiration Time since the UNIX epoch after which the entry expires [number] + --metadata Arbitrary JSON that is associated with a key [string] + --path Read value from the file at a given path [string] + --local Interact with local storage [boolean] + --persist-to Directory for local persistence [string]" + `); expect(std.err).toMatchInlineSnapshot(` "X [ERROR] Arguments binding and namespace-id are mutually exclusive @@ -700,33 +700,33 @@ describe("wrangler", () => { ); expect(std.out).toMatchInlineSnapshot(` - " - wrangler kv key put [value] - - Writes a single key/value pair to the given namespace. - - Positionals: - key The key to write to [string] [required] - value The value to write [string] - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] - - Options: - --binding The binding of the namespace to write to [string] - --namespace-id The id of the namespace to write to [string] - --preview Interact with a preview namespace [boolean] - --ttl Time for which the entries should be visible [number] - --expiration Time since the UNIX epoch after which the entry expires [number] - --metadata Arbitrary JSON that is associated with a key [string] - --path Read value from the file at a given path [string] - --local Interact with local storage [boolean] - --persist-to Directory for local persistence [string]" - `); + " + wrangler kv key put [value] + + Write a single key/value pair to the given namespace + + POSITIONALS + key The key to write to [string] [required] + value The value to write [string] + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] + + OPTIONS + --binding The binding of the namespace to write to [string] + --namespace-id The id of the namespace to write to [string] + --preview Interact with a preview namespace [boolean] + --ttl Time for which the entries should be visible [number] + --expiration Time since the UNIX epoch after which the entry expires [number] + --metadata Arbitrary JSON that is associated with a key [string] + --path Read value from the file at a given path [string] + --local Interact with local storage [boolean] + --persist-to Directory for local persistence [string]" + `); expect(std.err).toMatchInlineSnapshot(` "X [ERROR] Exactly one of the arguments value and path is required @@ -742,33 +742,33 @@ describe("wrangler", () => { ); expect(std.out).toMatchInlineSnapshot(` - " - wrangler kv key put [value] - - Writes a single key/value pair to the given namespace. - - Positionals: - key The key to write to [string] [required] - value The value to write [string] - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] - - Options: - --binding The binding of the namespace to write to [string] - --namespace-id The id of the namespace to write to [string] - --preview Interact with a preview namespace [boolean] - --ttl Time for which the entries should be visible [number] - --expiration Time since the UNIX epoch after which the entry expires [number] - --metadata Arbitrary JSON that is associated with a key [string] - --path Read value from the file at a given path [string] - --local Interact with local storage [boolean] - --persist-to Directory for local persistence [string]" - `); + " + wrangler kv key put [value] + + Write a single key/value pair to the given namespace + + POSITIONALS + key The key to write to [string] [required] + value The value to write [string] + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] + + OPTIONS + --binding The binding of the namespace to write to [string] + --namespace-id The id of the namespace to write to [string] + --preview Interact with a preview namespace [boolean] + --ttl Time for which the entries should be visible [number] + --expiration Time since the UNIX epoch after which the entry expires [number] + --metadata Arbitrary JSON that is associated with a key [string] + --path Read value from the file at a given path [string] + --local Interact with local storage [boolean] + --persist-to Directory for local persistence [string]" + `); expect(std.err).toMatchInlineSnapshot(` "X [ERROR] Arguments value and path are mutually exclusive @@ -1113,29 +1113,29 @@ describe("wrangler", () => { `[Error: Not enough non-option arguments: got 0, need at least 1]` ); expect(std.out).toMatchInlineSnapshot(` - " - wrangler kv key get - - Reads a single value by key from the given namespace. - - Positionals: - key The key value to get. [string] [required] - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] - - Options: - --binding The name of the namespace to get from [string] - --namespace-id The id of the namespace to get from [string] - --preview Interact with a preview namespace [boolean] [default: false] - --text Decode the returned value as a utf8 string [boolean] [default: false] - --local Interact with local storage [boolean] - --persist-to Directory for local persistence [string]" - `); + " + wrangler kv key get + + Read a single value by key from the given namespace + + POSITIONALS + key The key value to get. [string] [required] + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] + + OPTIONS + --binding The name of the namespace to get from [string] + --namespace-id The id of the namespace to get from [string] + --preview Interact with a preview namespace [boolean] [default: false] + --text Decode the returned value as a utf8 string [boolean] [default: false] + --local Interact with local storage [boolean] + --persist-to Directory for local persistence [string]" + `); expect(std.err).toMatchInlineSnapshot(` "X [ERROR] Not enough non-option arguments: got 0, need at least 1 @@ -1150,29 +1150,29 @@ describe("wrangler", () => { `[Error: Exactly one of the arguments binding and namespace-id is required]` ); expect(std.out).toMatchInlineSnapshot(` - " - wrangler kv key get - - Reads a single value by key from the given namespace. - - Positionals: - key The key value to get. [string] [required] - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] - - Options: - --binding The name of the namespace to get from [string] - --namespace-id The id of the namespace to get from [string] - --preview Interact with a preview namespace [boolean] [default: false] - --text Decode the returned value as a utf8 string [boolean] [default: false] - --local Interact with local storage [boolean] - --persist-to Directory for local persistence [string]" - `); + " + wrangler kv key get + + Read a single value by key from the given namespace + + POSITIONALS + key The key value to get. [string] [required] + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] + + OPTIONS + --binding The name of the namespace to get from [string] + --namespace-id The id of the namespace to get from [string] + --preview Interact with a preview namespace [boolean] [default: false] + --text Decode the returned value as a utf8 string [boolean] [default: false] + --local Interact with local storage [boolean] + --persist-to Directory for local persistence [string]" + `); expect(std.err).toMatchInlineSnapshot(` "X [ERROR] Exactly one of the arguments binding and namespace-id is required @@ -1188,29 +1188,29 @@ describe("wrangler", () => { ); expect(std.out).toMatchInlineSnapshot(` - " - wrangler kv key get - - Reads a single value by key from the given namespace. - - Positionals: - key The key value to get. [string] [required] - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] - - Options: - --binding The name of the namespace to get from [string] - --namespace-id The id of the namespace to get from [string] - --preview Interact with a preview namespace [boolean] [default: false] - --text Decode the returned value as a utf8 string [boolean] [default: false] - --local Interact with local storage [boolean] - --persist-to Directory for local persistence [string]" - `); + " + wrangler kv key get + + Read a single value by key from the given namespace + + POSITIONALS + key The key value to get. [string] [required] + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] + + OPTIONS + --binding The name of the namespace to get from [string] + --namespace-id The id of the namespace to get from [string] + --preview Interact with a preview namespace [boolean] [default: false] + --text Decode the returned value as a utf8 string [boolean] [default: false] + --local Interact with local storage [boolean] + --persist-to Directory for local persistence [string]" + `); expect(std.err).toMatchInlineSnapshot(` "X [ERROR] Arguments binding and namespace-id are mutually exclusive @@ -1725,17 +1725,17 @@ describe("wrangler", () => { expect(std.out).toMatchInlineSnapshot(` "wrangler kv:namespace - Commands: + COMMANDS wrangler kv:namespace create Create a new namespace - wrangler kv:namespace list Outputs a list of all KV namespaces associated with your account id. - wrangler kv:namespace delete Deletes a given namespace. - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" + wrangler kv:namespace list Output a list of all KV namespaces associated with your account id + wrangler kv:namespace delete Delete a given namespace. + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" `); }); test("kv:key", async () => { @@ -1745,18 +1745,18 @@ describe("wrangler", () => { expect(std.out).toMatchInlineSnapshot(` "wrangler kv:key - Commands: - wrangler kv:key put [value] Writes a single key/value pair to the given namespace. - wrangler kv:key list Outputs a list of all keys in a given namespace. - wrangler kv:key get Reads a single value by key from the given namespace. - wrangler kv:key delete Removes a single key value pair from the given namespace. - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" + COMMANDS + wrangler kv:key put [value] Write a single key/value pair to the given namespace + wrangler kv:key list Output a list of all keys in a given namespace + wrangler kv:key get Read a single value by key from the given namespace + wrangler kv:key delete Remove a single key value pair from the given namespace + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" `); }); test("kv:bulk", async () => { @@ -1766,16 +1766,16 @@ describe("wrangler", () => { expect(std.out).toMatchInlineSnapshot(` "wrangler kv:bulk - Commands: + COMMANDS wrangler kv:bulk put Upload multiple key-value pairs to a namespace wrangler kv:bulk delete Delete multiple key-value pairs from a namespace - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" `); }); }); diff --git a/packages/wrangler/src/__tests__/mtls-certificates.test.ts b/packages/wrangler/src/__tests__/mtls-certificates.test.ts index 2bb1a0c6d134..0ad2e3390a3c 100644 --- a/packages/wrangler/src/__tests__/mtls-certificates.test.ts +++ b/packages/wrangler/src/__tests__/mtls-certificates.test.ts @@ -355,22 +355,22 @@ describe("wrangler", () => { await runWrangler("mtls-certificate --help"); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.out).toMatchInlineSnapshot(` - "wrangler mtls-certificate - - ๐Ÿชช Manage certificates used for mTLS connections - - Commands: - wrangler mtls-certificate upload Upload an mTLS certificate - wrangler mtls-certificate list List uploaded mTLS certificates - wrangler mtls-certificate delete Delete an mTLS certificate - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + "wrangler mtls-certificate + + ๐Ÿชช Manage certificates used for mTLS connections + + COMMANDS + wrangler mtls-certificate upload Upload an mTLS certificate + wrangler mtls-certificate list List uploaded mTLS certificates + wrangler mtls-certificate delete Delete an mTLS certificate + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); }); diff --git a/packages/wrangler/src/__tests__/pages/deploy.test.ts b/packages/wrangler/src/__tests__/pages/deploy.test.ts index e6df5ce6ed97..421b74aec37d 100644 --- a/packages/wrangler/src/__tests__/pages/deploy.test.ts +++ b/packages/wrangler/src/__tests__/pages/deploy.test.ts @@ -57,16 +57,16 @@ describe("pages deploy", () => { expect(std.out).toMatchInlineSnapshot(` "wrangler pages deploy [directory] - ๐Ÿ†™ Deploy a directory of static assets as a Pages deployment + Deploy a directory of static assets as a Pages deployment - Positionals: + POSITIONALS directory The directory of static files to upload [string] - Flags: - -h, --help Show help [boolean] - -v, --version Show version number [boolean] + GLOBAL FLAGS + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] - Options: + OPTIONS --project-name The name of the project you want to deploy to [string] --branch The name of the branch you want to deploy to [string] --commit-hash The SHA to attach to this deployment [string] diff --git a/packages/wrangler/src/__tests__/pages/pages.test.ts b/packages/wrangler/src/__tests__/pages/pages.test.ts index 00bb71d9945d..24a455008b41 100644 --- a/packages/wrangler/src/__tests__/pages/pages.test.ts +++ b/packages/wrangler/src/__tests__/pages/pages.test.ts @@ -18,22 +18,22 @@ describe("pages", () => { await endEventLoop(); expect(std.out).toMatchInlineSnapshot(` - "wrangler pages - - โšก๏ธ Configure Cloudflare Pages - - Commands: - wrangler pages dev [directory] [-- command..] ๐Ÿง‘โ€๐Ÿ’ป Develop your full-stack Pages application locally - wrangler pages project โšก๏ธ Interact with your Pages projects - wrangler pages deployment ๐Ÿš€ Interact with the deployments of a project - wrangler pages deploy [directory] ๐Ÿ†™ Deploy a directory of static assets as a Pages deployment [aliases: publish] - wrangler pages secret ๐Ÿคซ Generate a secret that can be referenced in a Pages project - wrangler pages download โšก๏ธ Download settings from your project - - Flags: - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + "wrangler pages + + โšก๏ธ Configure Cloudflare Pages + + COMMANDS + wrangler pages dev [directory] [-- command..] Develop your full-stack Pages application locally + wrangler pages project Interact with your Pages projects + wrangler pages deployment Interact with the deployments of a project + wrangler pages deploy [directory] Deploy a directory of static assets as a Pages deployment [aliases: publish] + wrangler pages secret Generate a secret that can be referenced in a Pages project + wrangler pages download Download settings from your project + + GLOBAL FLAGS + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); describe("deprecation message for deprecated options", () => { diff --git a/packages/wrangler/src/__tests__/pubsub.test.ts b/packages/wrangler/src/__tests__/pubsub.test.ts index 3e452d3858d0..cd1ebc1f1412 100644 --- a/packages/wrangler/src/__tests__/pubsub.test.ts +++ b/packages/wrangler/src/__tests__/pubsub.test.ts @@ -22,29 +22,29 @@ describe("wrangler", () => { it("shows usage details", async () => { await runWrangler("pubsub --help"); expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "", - "out": "wrangler pubsub - - ๐Ÿ“ฎ Interact and manage Pub/Sub Brokers - - Commands: - wrangler pubsub namespace Manage your Pub/Sub Namespaces - wrangler pubsub broker Interact with your Pub/Sub Brokers - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] - - ๐Ÿ‘ท๐Ÿฝ 'wrangler pubsub ...' commands are currently in private beta. If your account isn't authorized, commands will fail. Visit the Pub/Sub docs for more info: https://developers.cloudflare.com/pub-sub/", - "warn": "", - } - `); + Object { + "debug": "", + "err": "", + "info": "", + "out": "wrangler pubsub + + ๐Ÿ“ฎ Manage Pub/Sub brokers [private beta] + + COMMANDS + wrangler pubsub namespace Manage your Pub/Sub Namespaces + wrangler pubsub broker Interact with your Pub/Sub Brokers + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] + + ๐Ÿ‘ท๐Ÿฝ 'wrangler pubsub ...' commands are currently in private beta. If your account isn't authorized, commands will fail. Visit the Pub/Sub docs for more info: https://developers.cloudflare.com/pub-sub/", + "warn": "", + } + `); }); }); @@ -53,31 +53,31 @@ describe("wrangler", () => { it("shows usage details", async () => { await runWrangler("pubsub namespace --help"); expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "", - "out": "wrangler pubsub namespace - - Manage your Pub/Sub Namespaces - - Commands: - wrangler pubsub namespace create Create a new Pub/Sub Namespace - wrangler pubsub namespace list List your existing Pub/Sub Namespaces - wrangler pubsub namespace delete Delete a Pub/Sub Namespace - wrangler pubsub namespace describe Describe a Pub/Sub Namespace - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] - - ๐Ÿ‘ท๐Ÿฝ 'wrangler pubsub ...' commands are currently in private beta. If your account isn't authorized, commands will fail. Visit the Pub/Sub docs for more info: https://developers.cloudflare.com/pub-sub/", - "warn": "", - } - `); + Object { + "debug": "", + "err": "", + "info": "", + "out": "wrangler pubsub namespace + + Manage your Pub/Sub Namespaces + + COMMANDS + wrangler pubsub namespace create Create a new Pub/Sub Namespace + wrangler pubsub namespace list List your existing Pub/Sub Namespaces + wrangler pubsub namespace delete Delete a Pub/Sub Namespace + wrangler pubsub namespace describe Describe a Pub/Sub Namespace + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] + + ๐Ÿ‘ท๐Ÿฝ 'wrangler pubsub ...' commands are currently in private beta. If your account isn't authorized, commands will fail. Visit the Pub/Sub docs for more info: https://developers.cloudflare.com/pub-sub/", + "warn": "", + } + `); }); }); @@ -175,37 +175,37 @@ describe("wrangler", () => { it("shows usage details", async () => { await runWrangler("pubsub broker --help"); expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "", - "out": "wrangler pubsub broker - - Interact with your Pub/Sub Brokers - - Commands: - wrangler pubsub broker create Create a new Pub/Sub Broker - wrangler pubsub broker update Update an existing Pub/Sub Broker's configuration. - wrangler pubsub broker list List the Pub/Sub Brokers within a Namespace - wrangler pubsub broker delete Delete an existing Pub/Sub Broker - wrangler pubsub broker describe Describe an existing Pub/Sub Broker. - wrangler pubsub broker issue Issue new client credentials for a specific Pub/Sub Broker. - wrangler pubsub broker revoke Revoke a set of active client credentials associated with the given Broker - wrangler pubsub broker unrevoke Restore access to a set of previously revoked client credentials. - wrangler pubsub broker show-revocations Show all previously revoked client credentials. - wrangler pubsub broker public-keys Show the public keys used for verifying on-publish hooks and credentials for a Broker. - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] - - ๐Ÿ‘ท๐Ÿฝ 'wrangler pubsub ...' commands are currently in private beta. If your account isn't authorized, commands will fail. Visit the Pub/Sub docs for more info: https://developers.cloudflare.com/pub-sub/", - "warn": "", - } - `); + Object { + "debug": "", + "err": "", + "info": "", + "out": "wrangler pubsub broker + + Interact with your Pub/Sub Brokers + + COMMANDS + wrangler pubsub broker create Create a new Pub/Sub Broker + wrangler pubsub broker update Update an existing Pub/Sub Broker's configuration. + wrangler pubsub broker list List the Pub/Sub Brokers within a Namespace + wrangler pubsub broker delete Delete an existing Pub/Sub Broker + wrangler pubsub broker describe Describe an existing Pub/Sub Broker. + wrangler pubsub broker issue Issue new client credentials for a specific Pub/Sub Broker. + wrangler pubsub broker revoke Revoke a set of active client credentials associated with the given Broker + wrangler pubsub broker unrevoke Restore access to a set of previously revoked client credentials. + wrangler pubsub broker show-revocations Show all previously revoked client credentials. + wrangler pubsub broker public-keys Show the public keys used for verifying on-publish hooks and credentials for a Broker. + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] + + ๐Ÿ‘ท๐Ÿฝ 'wrangler pubsub ...' commands are currently in private beta. If your account isn't authorized, commands will fail. Visit the Pub/Sub docs for more info: https://developers.cloudflare.com/pub-sub/", + "warn": "", + } + `); }); }); diff --git a/packages/wrangler/src/__tests__/queues.test.ts b/packages/wrangler/src/__tests__/queues.test.ts index c35e7f010920..27fa62c73207 100644 --- a/packages/wrangler/src/__tests__/queues.test.ts +++ b/packages/wrangler/src/__tests__/queues.test.ts @@ -21,23 +21,23 @@ describe("wrangler", () => { await runWrangler("queues --help"); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.out).toMatchInlineSnapshot(` - "wrangler queues - - ๐Ÿ‡ถ Configure Workers Queues - - Commands: - wrangler queues list List Queues - wrangler queues create Create a Queue - wrangler queues delete Delete a Queue - wrangler queues consumer Configure Queue Consumers - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + "wrangler queues + + ๐Ÿ‡ถ Manage Workers Queues + + COMMANDS + wrangler queues list List Queues + wrangler queues create Create a Queue + wrangler queues delete Delete a Queue + wrangler queues consumer Configure Queue consumers + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); function mockGetQueueByNameRequest( @@ -101,20 +101,20 @@ describe("wrangler", () => { await runWrangler("queues list --help"); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.out).toMatchInlineSnapshot(` - "wrangler queues list + "wrangler queues list - List Queues + List Queues - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] - Options: - --page Page number for pagination [number]" - `); + OPTIONS + --page Page number for pagination [number]" + `); }); it("should list queues on page 1 with no --page", async () => { @@ -235,23 +235,23 @@ describe("wrangler", () => { await runWrangler("queues create --help"); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.out).toMatchInlineSnapshot(` - "wrangler queues create + "wrangler queues create - Create a Queue + Create a Queue - Positionals: - name The name of the queue [string] [required] + POSITIONALS + name The name of the queue [string] [required] - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] - Options: - --delivery-delay-secs How long a published message should be delayed for, in seconds. Must be a positive integer [number]" - `); + OPTIONS + --delivery-delay-secs How long a published message should be delayed for, in seconds. Must be a positive integer [number]" + `); }); it("should create a queue", async () => { @@ -356,20 +356,20 @@ describe("wrangler", () => { await runWrangler("queues delete --help"); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.out).toMatchInlineSnapshot(` - "wrangler queues delete + "wrangler queues delete - Delete a Queue + Delete a Queue - Positionals: - name The name of the queue [string] [required] + POSITIONALS + name The name of the queue [string] [required] - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); it("should delete a queue", async () => { @@ -422,23 +422,23 @@ describe("wrangler", () => { expect(std.err).toMatchInlineSnapshot(`""`); expect(std.out).toMatchInlineSnapshot(` - "wrangler queues consumer - - Configure Queue Consumers - - Commands: - wrangler queues consumer add Add a Queue Worker Consumer - wrangler queues consumer remove Remove a Queue Worker Consumer - wrangler queues consumer http Configure Queue HTTP Pull Consumers - wrangler queues consumer worker Configure Queue Worker Consumers - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + "wrangler queues consumer + + Configure Queue consumers + + COMMANDS + wrangler queues consumer add Add a Queue Worker Consumer + wrangler queues consumer remove Remove a Queue Worker Consumer + wrangler queues consumer http Configure Queue HTTP Pull Consumers + wrangler queues consumer worker Configure Queue Worker Consumers + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); describe("add", () => { @@ -472,29 +472,29 @@ describe("wrangler", () => { await runWrangler("queues consumer add --help"); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.out).toMatchInlineSnapshot(` - "wrangler queues consumer add - - Add a Queue Worker Consumer - - Positionals: - queue-name Name of the queue to configure [string] [required] - script-name Name of the consumer script [string] [required] - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] - - Options: - --batch-size Maximum number of messages per batch [number] - --batch-timeout Maximum number of seconds to wait to fill a batch with messages [number] - --message-retries Maximum number of retries for each message [number] - --dead-letter-queue Queue to send messages that failed to be consumed [string] - --max-concurrency The maximum number of concurrent consumer Worker invocations. Must be a positive integer [number] - --retry-delay-secs The number of seconds to wait before retrying a message [number]" - `); + "wrangler queues consumer add + + Add a Queue Worker Consumer + + POSITIONALS + queue-name Name of the queue to configure [string] [required] + script-name Name of the consumer script [string] [required] + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] + + OPTIONS + --batch-size Maximum number of messages per batch [number] + --batch-timeout Maximum number of seconds to wait to fill a batch with messages [number] + --message-retries Maximum number of retries for each message [number] + --dead-letter-queue Queue to send messages that failed to be consumed [string] + --max-concurrency The maximum number of concurrent consumer Worker invocations. Must be a positive integer [number] + --retry-delay-secs The number of seconds to wait before retrying a message [number]" + `); }); it("should add a consumer using defaults", async () => { @@ -794,21 +794,21 @@ describe("wrangler", () => { await runWrangler("queues consumer remove --help"); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.out).toMatchInlineSnapshot(` - "wrangler queues consumer remove + "wrangler queues consumer remove - Remove a Queue Worker Consumer + Remove a Queue Worker Consumer - Positionals: - queue-name Name of the queue to configure [string] [required] - script-name Name of the consumer script [string] [required] + POSITIONALS + queue-name Name of the queue to configure [string] [required] + script-name Name of the consumer script [string] [required] - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); it("should show an error when queue does not exist", async () => { @@ -1182,21 +1182,21 @@ describe("wrangler", () => { expect(std.err).toMatchInlineSnapshot(`""`); expect(std.out).toMatchInlineSnapshot(` - "wrangler queues consumer http + "wrangler queues consumer http - Configure Queue HTTP Pull Consumers + Configure Queue HTTP Pull Consumers - Commands: - wrangler queues consumer http add Add a Queue HTTP Pull Consumer - wrangler queues consumer http remove Remove a Queue HTTP Pull Consumer + COMMANDS + wrangler queues consumer http add Add a Queue HTTP Pull Consumer + wrangler queues consumer http remove Remove a Queue HTTP Pull Consumer - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); describe("add", () => { @@ -1230,27 +1230,27 @@ describe("wrangler", () => { await runWrangler("queues consumer http add --help"); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.out).toMatchInlineSnapshot(` - "wrangler queues consumer http add - - Add a Queue HTTP Pull Consumer - - Positionals: - queue-name Name of the queue for the consumer [string] [required] - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] - - Options: - --batch-size Maximum number of messages per batch [number] - --message-retries Maximum number of retries for each message [number] - --dead-letter-queue Queue to send messages that failed to be consumed [string] - --visibility-timeout-secs The number of seconds a message will wait for an acknowledgement before being returned to the queue. [number] - --retry-delay-secs The number of seconds to wait before retrying a message [number]" - `); + "wrangler queues consumer http add + + Add a Queue HTTP Pull Consumer + + POSITIONALS + queue-name Name of the queue for the consumer [string] [required] + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] + + OPTIONS + --batch-size Maximum number of messages per batch [number] + --message-retries Maximum number of retries for each message [number] + --dead-letter-queue Queue to send messages that failed to be consumed [string] + --visibility-timeout-secs The number of seconds a message will wait for an acknowledgement before being returned to the queue. [number] + --retry-delay-secs The number of seconds to wait before retrying a message [number]" + `); }); it("should add a consumer using defaults", async () => { @@ -1361,20 +1361,20 @@ describe("wrangler", () => { await runWrangler("queues consumer http remove --help"); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.out).toMatchInlineSnapshot(` - "wrangler queues consumer http remove + "wrangler queues consumer http remove - Remove a Queue HTTP Pull Consumer + Remove a Queue HTTP Pull Consumer - Positionals: - queue-name Name of the queue for the consumer [string] [required] + POSITIONALS + queue-name Name of the queue for the consumer [string] [required] - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); it("should delete a pull consumer", async () => { diff --git a/packages/wrangler/src/__tests__/r2.test.ts b/packages/wrangler/src/__tests__/r2.test.ts index f1f621585682..55c7d7c15202 100644 --- a/packages/wrangler/src/__tests__/r2.test.ts +++ b/packages/wrangler/src/__tests__/r2.test.ts @@ -37,26 +37,26 @@ describe("r2", () => { " `); expect(std.out).toMatchInlineSnapshot(` - " - wrangler r2 bucket - - Manage R2 buckets - - Commands: - wrangler r2 bucket create Create a new R2 bucket - wrangler r2 bucket update Update bucket state - wrangler r2 bucket list List R2 buckets - wrangler r2 bucket delete Delete an R2 bucket - wrangler r2 bucket sippy Manage Sippy incremental migration on an R2 bucket - wrangler r2 bucket notification Manage event notifications for an R2 bucket - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + " + wrangler r2 bucket + + Manage R2 buckets + + COMMANDS + wrangler r2 bucket create Create a new R2 bucket + wrangler r2 bucket update Update bucket state + wrangler r2 bucket list List R2 buckets + wrangler r2 bucket delete Delete an R2 bucket + wrangler r2 bucket sippy Manage Sippy incremental migration on an R2 bucket + wrangler r2 bucket notification Manage event notifications for an R2 bucket + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); describe("list", () => { @@ -106,25 +106,25 @@ describe("r2", () => { `[Error: Not enough non-option arguments: got 0, need at least 1]` ); expect(std.out).toMatchInlineSnapshot(` - " - wrangler r2 bucket create + " + wrangler r2 bucket create - Create a new R2 bucket + Create a new R2 bucket - Positionals: - name The name of the new bucket [string] [required] + POSITIONALS + name The name of the new bucket [string] [required] - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] - Options: - -J, --jurisdiction The jurisdiction where the new bucket will be created [string] - -s, --storage-class The default storage class for objects uploaded to this bucket [string]" - `); + OPTIONS + -J, --jurisdiction The jurisdiction where the new bucket will be created [string] + -s, --storage-class The default storage class for objects uploaded to this bucket [string]" + `); expect(std.err).toMatchInlineSnapshot(` "X [ERROR] Not enough non-option arguments: got 0, need at least 1 @@ -139,25 +139,25 @@ describe("r2", () => { `[Error: Unknown arguments: def, ghi]` ); expect(std.out).toMatchInlineSnapshot(` - " - wrangler r2 bucket create + " + wrangler r2 bucket create - Create a new R2 bucket + Create a new R2 bucket - Positionals: - name The name of the new bucket [string] [required] + POSITIONALS + name The name of the new bucket [string] [required] - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] - Options: - -J, --jurisdiction The jurisdiction where the new bucket will be created [string] - -s, --storage-class The default storage class for objects uploaded to this bucket [string]" - `); + OPTIONS + -J, --jurisdiction The jurisdiction where the new bucket will be created [string] + -s, --storage-class The default storage class for objects uploaded to this bucket [string]" + `); expect(std.err).toMatchInlineSnapshot(` "X [ERROR] Unknown arguments: def, ghi @@ -243,21 +243,21 @@ describe("r2", () => { `[Error: Unknown argument: foo]` ); expect(std.out).toMatchInlineSnapshot(` - " - wrangler r2 bucket update + " + wrangler r2 bucket update - Update bucket state + Update bucket state - Commands: - wrangler r2 bucket update storage-class Update the default storage class of an existing R2 bucket + COMMANDS + wrangler r2 bucket update storage-class Update the default storage class of an existing R2 bucket - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); expect(std.err).toMatchInlineSnapshot(` "X [ERROR] Unknown argument: foo @@ -273,25 +273,25 @@ describe("r2", () => { `[Error: Missing required argument: storage-class]` ); expect(std.out).toMatchInlineSnapshot(` - " - wrangler r2 bucket update storage-class + " + wrangler r2 bucket update storage-class - Update the default storage class of an existing R2 bucket + Update the default storage class of an existing R2 bucket - Positionals: - name The name of the existing bucket [string] [required] + POSITIONALS + name The name of the existing bucket [string] [required] - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] - Options: - -J, --jurisdiction The jurisdiction of the bucket to be updated [string] - -s, --storage-class The new default storage class for this bucket [string] [required]" - `); + OPTIONS + -J, --jurisdiction The jurisdiction of the bucket to be updated [string] + -s, --storage-class The new default storage class for this bucket [string] [required]" + `); expect(std.err).toMatchInlineSnapshot(` "X [ERROR] Missing required argument: storage-class @@ -339,24 +339,24 @@ describe("r2", () => { `[Error: Not enough non-option arguments: got 0, need at least 1]` ); expect(std.out).toMatchInlineSnapshot(` - " - wrangler r2 bucket delete + " + wrangler r2 bucket delete - Delete an R2 bucket + Delete an R2 bucket - Positionals: - name The name of the bucket to delete [string] [required] + POSITIONALS + name The name of the bucket to delete [string] [required] - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] - Options: - -J, --jurisdiction The jurisdiction where the bucket exists [string]" - `); + OPTIONS + -J, --jurisdiction The jurisdiction where the bucket exists [string]" + `); expect(std.err).toMatchInlineSnapshot(` "X [ERROR] Not enough non-option arguments: got 0, need at least 1 @@ -371,24 +371,24 @@ describe("r2", () => { `[Error: Unknown arguments: def, ghi]` ); expect(std.out).toMatchInlineSnapshot(` - " - wrangler r2 bucket delete + " + wrangler r2 bucket delete - Delete an R2 bucket + Delete an R2 bucket - Positionals: - name The name of the bucket to delete [string] [required] + POSITIONALS + name The name of the bucket to delete [string] [required] - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] - Options: - -J, --jurisdiction The jurisdiction where the bucket exists [string]" - `); + OPTIONS + -J, --jurisdiction The jurisdiction where the bucket exists [string]" + `); expect(std.err).toMatchInlineSnapshot(` "X [ERROR] Unknown arguments: def, ghi @@ -437,23 +437,23 @@ describe("r2", () => { " `); expect(std.out).toMatchInlineSnapshot(` - " - wrangler r2 bucket sippy - - Manage Sippy incremental migration on an R2 bucket - - Commands: - wrangler r2 bucket sippy enable Enable Sippy on an R2 bucket - wrangler r2 bucket sippy disable Disable Sippy on an R2 bucket - wrangler r2 bucket sippy get Check the status of Sippy on an R2 bucket - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + " + wrangler r2 bucket sippy + + Manage Sippy incremental migration on an R2 bucket + + COMMANDS + wrangler r2 bucket sippy enable Enable Sippy on an R2 bucket + wrangler r2 bucket sippy disable Disable Sippy on an R2 bucket + wrangler r2 bucket sippy get Check the status of Sippy on an R2 bucket + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); describe("enable", () => { @@ -531,34 +531,34 @@ describe("r2", () => { `[Error: Not enough non-option arguments: got 0, need at least 1]` ); expect(std.out).toMatchInlineSnapshot(` - " - wrangler r2 bucket sippy enable - - Enable Sippy on an R2 bucket - - Positionals: - name The name of the bucket [string] [required] - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] - - Options: - -J, --jurisdiction The jurisdiction where the bucket exists [string] - --provider [choices: \\"AWS\\", \\"GCS\\"] - --bucket The name of the upstream bucket [string] - --region (AWS provider only) The region of the upstream bucket [string] - --access-key-id (AWS provider only) The secret access key id for the upstream bucket [string] - --secret-access-key (AWS provider only) The secret access key for the upstream bucket [string] - --service-account-key-file (GCS provider only) The path to your Google Cloud service account key JSON file [string] - --client-email (GCS provider only) The client email for your Google Cloud service account key [string] - --private-key (GCS provider only) The private key for your Google Cloud service account key [string] - --r2-access-key-id The secret access key id for this R2 bucket [string] - --r2-secret-access-key The secret access key for this R2 bucket [string]" - `); + " + wrangler r2 bucket sippy enable + + Enable Sippy on an R2 bucket + + POSITIONALS + name The name of the bucket [string] [required] + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] + + OPTIONS + -J, --jurisdiction The jurisdiction where the bucket exists [string] + --provider [choices: \\"AWS\\", \\"GCS\\"] + --bucket The name of the upstream bucket [string] + --region (AWS provider only) The region of the upstream bucket [string] + --access-key-id (AWS provider only) The secret access key id for the upstream bucket [string] + --secret-access-key (AWS provider only) The secret access key for the upstream bucket [string] + --service-account-key-file (GCS provider only) The path to your Google Cloud service account key JSON file [string] + --client-email (GCS provider only) The client email for your Google Cloud service account key [string] + --private-key (GCS provider only) The private key for your Google Cloud service account key [string] + --r2-access-key-id The secret access key id for this R2 bucket [string] + --r2-secret-access-key The secret access key for this R2 bucket [string]" + `); expect(std.err).toMatchInlineSnapshot(` "X [ERROR] Not enough non-option arguments: got 0, need at least 1 @@ -575,24 +575,24 @@ describe("r2", () => { `[Error: Not enough non-option arguments: got 0, need at least 1]` ); expect(std.out).toMatchInlineSnapshot(` - " - wrangler r2 bucket sippy disable + " + wrangler r2 bucket sippy disable - Disable Sippy on an R2 bucket + Disable Sippy on an R2 bucket - Positionals: - name The name of the bucket [string] [required] + POSITIONALS + name The name of the bucket [string] [required] - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] - Options: - -J, --jurisdiction The jurisdiction where the bucket exists [string]" - `); + OPTIONS + -J, --jurisdiction The jurisdiction where the bucket exists [string]" + `); expect(std.err).toMatchInlineSnapshot(` "X [ERROR] Not enough non-option arguments: got 0, need at least 1 @@ -627,24 +627,24 @@ describe("r2", () => { `[Error: Not enough non-option arguments: got 0, need at least 1]` ); expect(std.out).toMatchInlineSnapshot(` - " - wrangler r2 bucket sippy get + " + wrangler r2 bucket sippy get - Check the status of Sippy on an R2 bucket + Check the status of Sippy on an R2 bucket - Positionals: - name The name of the bucket [string] [required] + POSITIONALS + name The name of the bucket [string] [required] - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] - Options: - -J, --jurisdiction The jurisdiction where the bucket exists [string]" - `); + OPTIONS + -J, --jurisdiction The jurisdiction where the bucket exists [string]" + `); expect(std.err).toMatchInlineSnapshot(` "X [ERROR] Not enough non-option arguments: got 0, need at least 1 @@ -753,21 +753,21 @@ describe("r2", () => { `[Error: Not enough non-option arguments: got 0, need at least 1]` ); expect(std.out).toMatchInlineSnapshot(` - " - wrangler r2 bucket notification get + " + wrangler r2 bucket notification get - Get event notification configuration for a bucket + Get event notification configuration for a bucket - Positionals: - bucket The name of the bucket for which notifications will be emitted [string] [required] + POSITIONALS + bucket The name of the bucket for which notifications will be emitted [string] [required] - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); }); describe("create", () => { @@ -859,27 +859,27 @@ describe("r2", () => { `[Error: Missing required arguments: event-types, queue]` ); expect(std.out).toMatchInlineSnapshot(` - " - wrangler r2 bucket notification create - - Create new event notification configuration for an R2 bucket - - Positionals: - bucket The name of the bucket for which notifications will be emitted [string] [required] - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] - - Options: - --event-types, --event-type Specify the kinds of object events to emit notifications for. ex. '--event-types object-create object-delete' [array] [required] [choices: \\"object-create\\", \\"object-delete\\"] - --prefix only actions on objects with this prefix will emit notifications [string] - --suffix only actions on objects with this suffix will emit notifications [string] - --queue The name of the queue to which event notifications will be sent. ex '--queue my-queue' [string] [required]" - `); + " + wrangler r2 bucket notification create + + Create new event notification configuration for an R2 bucket + + POSITIONALS + bucket The name of the bucket for which notifications will be emitted [string] [required] + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] + + OPTIONS + --event-types, --event-type Specify the kinds of object events to emit notifications for. ex. '--event-types object-create object-delete' [array] [required] [choices: \\"object-create\\", \\"object-delete\\"] + --prefix only actions on objects with this prefix will emit notifications [string] + --suffix only actions on objects with this suffix will emit notifications [string] + --queue The name of the queue to which event notifications will be sent. ex '--queue my-queue' [string] [required]" + `); }); }); @@ -951,24 +951,24 @@ describe("r2", () => { `[Error: Missing required argument: queue]` ); expect(std.out).toMatchInlineSnapshot(` - " - wrangler r2 bucket notification delete + " + wrangler r2 bucket notification delete - Delete event notification configuration for an R2 bucket and queue + Delete event notification configuration for an R2 bucket and queue - Positionals: - bucket The name of the bucket for which notifications will be emitted [string] [required] + POSITIONALS + bucket The name of the bucket for which notifications will be emitted [string] [required] - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] - Options: - --queue The name of the queue that is configured to receive notifications. ex '--queue my-queue' [string] [required]" - `); + OPTIONS + --queue The name of the queue that is configured to receive notifications. ex '--queue my-queue' [string] [required]" + `); }); }); }); diff --git a/packages/wrangler/src/__tests__/secret.test.ts b/packages/wrangler/src/__tests__/secret.test.ts index ba26ef430f7b..64ad3af235eb 100644 --- a/packages/wrangler/src/__tests__/secret.test.ts +++ b/packages/wrangler/src/__tests__/secret.test.ts @@ -901,17 +901,17 @@ describe("wrangler secret", () => { expect(std.out).toMatchInlineSnapshot(` "wrangler secret:bulk [json] - Positionals: + POSITIONALS json The JSON file of key-value pairs to upload, in form {\\"key\\": value, ...} [string] - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] - Options: + OPTIONS --name Name of the Worker [string]" `); }); diff --git a/packages/wrangler/src/__tests__/vectorize/vectorize.test.ts b/packages/wrangler/src/__tests__/vectorize/vectorize.test.ts index 6ce4528c27ad..efc5957d4808 100644 --- a/packages/wrangler/src/__tests__/vectorize/vectorize.test.ts +++ b/packages/wrangler/src/__tests__/vectorize/vectorize.test.ts @@ -17,31 +17,31 @@ describe("vectorize help", () => { await endEventLoop(); expect(std.out).toMatchInlineSnapshot(` - "wrangler vectorize - - ๐Ÿงฎ Interact with Vectorize indexes - - Commands: - wrangler vectorize create Create a Vectorize index - wrangler vectorize delete Delete a Vectorize index - wrangler vectorize get Get a Vectorize index by name - wrangler vectorize list List your Vectorize indexes - wrangler vectorize insert Insert vectors into a Vectorize index - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] - - -------------------- - ๐Ÿ“ฃ Vectorize is currently in open beta - ๐Ÿ“ฃ See the Vectorize docs for how to get started and known issues: https://developers.cloudflare.com/vectorize - ๐Ÿ“ฃ Please report any bugs to https://github.com/cloudflare/workers-sdk/issues/new/choose - ๐Ÿ“ฃ To give feedback, visit https://discord.cloudflare.com/ - --------------------" - `); + "wrangler vectorize + + ๐Ÿงฎ Manage Vectorize indexes [open beta] + + COMMANDS + wrangler vectorize create Create a Vectorize index + wrangler vectorize delete Delete a Vectorize index + wrangler vectorize get Get a Vectorize index by name + wrangler vectorize list List your Vectorize indexes + wrangler vectorize insert Insert vectors into a Vectorize index + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] + + -------------------- + ๐Ÿ“ฃ Vectorize is currently in open beta + ๐Ÿ“ฃ See the Vectorize docs for how to get started and known issues: https://developers.cloudflare.com/vectorize + ๐Ÿ“ฃ Please report any bugs to https://github.com/cloudflare/workers-sdk/issues/new/choose + ๐Ÿ“ฃ To give feedback, visit https://discord.cloudflare.com/ + --------------------" + `); }); it("should show help when an invalid argument is passed", async () => { @@ -55,32 +55,32 @@ describe("vectorize help", () => { " `); expect(std.out).toMatchInlineSnapshot(` - " - wrangler vectorize - - ๐Ÿงฎ Interact with Vectorize indexes - - Commands: - wrangler vectorize create Create a Vectorize index - wrangler vectorize delete Delete a Vectorize index - wrangler vectorize get Get a Vectorize index by name - wrangler vectorize list List your Vectorize indexes - wrangler vectorize insert Insert vectors into a Vectorize index - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] - - -------------------- - ๐Ÿ“ฃ Vectorize is currently in open beta - ๐Ÿ“ฃ See the Vectorize docs for how to get started and known issues: https://developers.cloudflare.com/vectorize - ๐Ÿ“ฃ Please report any bugs to https://github.com/cloudflare/workers-sdk/issues/new/choose - ๐Ÿ“ฃ To give feedback, visit https://discord.cloudflare.com/ - --------------------" - `); + " + wrangler vectorize + + ๐Ÿงฎ Manage Vectorize indexes [open beta] + + COMMANDS + wrangler vectorize create Create a Vectorize index + wrangler vectorize delete Delete a Vectorize index + wrangler vectorize get Get a Vectorize index by name + wrangler vectorize list List your Vectorize indexes + wrangler vectorize insert Insert vectors into a Vectorize index + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] + + -------------------- + ๐Ÿ“ฃ Vectorize is currently in open beta + ๐Ÿ“ฃ See the Vectorize docs for how to get started and known issues: https://developers.cloudflare.com/vectorize + ๐Ÿ“ฃ Please report any bugs to https://github.com/cloudflare/workers-sdk/issues/new/choose + ๐Ÿ“ฃ To give feedback, visit https://discord.cloudflare.com/ + --------------------" + `); }); it("should show help when the get command is passed without an index", async () => { @@ -94,31 +94,31 @@ describe("vectorize help", () => { " `); expect(std.out).toMatchInlineSnapshot(` - " - wrangler vectorize get + " + wrangler vectorize get - Get a Vectorize index by name + Get a Vectorize index by name - Positionals: - name The name of the Vectorize index. [string] [required] + POSITIONALS + name The name of the Vectorize index. [string] [required] - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean] + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] - Options: - --json return output as clean JSON [boolean] [default: false] + OPTIONS + --json return output as clean JSON [boolean] [default: false] - -------------------- - ๐Ÿ“ฃ Vectorize is currently in open beta - ๐Ÿ“ฃ See the Vectorize docs for how to get started and known issues: https://developers.cloudflare.com/vectorize - ๐Ÿ“ฃ Please report any bugs to https://github.com/cloudflare/workers-sdk/issues/new/choose - ๐Ÿ“ฃ To give feedback, visit https://discord.cloudflare.com/ - --------------------" - `); + -------------------- + ๐Ÿ“ฃ Vectorize is currently in open beta + ๐Ÿ“ฃ See the Vectorize docs for how to get started and known issues: https://developers.cloudflare.com/vectorize + ๐Ÿ“ฃ Please report any bugs to https://github.com/cloudflare/workers-sdk/issues/new/choose + ๐Ÿ“ฃ To give feedback, visit https://discord.cloudflare.com/ + --------------------" + `); }); }); diff --git a/packages/wrangler/src/__tests__/versions/versions.help.test.ts b/packages/wrangler/src/__tests__/versions/versions.help.test.ts index b43cea3e50bd..c39ee773bfbe 100644 --- a/packages/wrangler/src/__tests__/versions/versions.help.test.ts +++ b/packages/wrangler/src/__tests__/versions/versions.help.test.ts @@ -13,39 +13,43 @@ describe("versions --help", () => { expect(std.out).toMatchInlineSnapshot(` "wrangler - Commands: - wrangler docs [command..] ๐Ÿ“š Open wrangler's docs in your browser - wrangler init [name] ๐Ÿ“ฅ Initialize a basic Worker project, including a wrangler.toml file - wrangler generate [name] [template] โœจ Generate a new Worker project from an existing Worker template. See https://github.com/cloudflare/workers-sdk/tree/main/templates - wrangler dev [script] ๐Ÿ‘‚ Start a local server for developing your worker - wrangler deploy [script] ๐Ÿ†™ Deploy your Worker to Cloudflare. [aliases: publish] - wrangler delete [script] ๐Ÿ—‘ Delete your Worker from Cloudflare. - wrangler tail [worker] ๐Ÿฆš Starts a log tailing session for a published Worker. - wrangler secret ๐Ÿคซ Generate a secret that can be referenced in a Worker - wrangler kv ๐Ÿ—‚๏ธ Interact with your Workers KV Namespaces - wrangler pages โšก๏ธ Configure Cloudflare Pages - wrangler queues ๐Ÿ‡ถ Configure Workers Queues - wrangler r2 ๐Ÿ“ฆ Interact with an R2 store - wrangler dispatch-namespace ๐Ÿ“ฆ Interact with a dispatch namespace - wrangler d1 ๐Ÿ—„ Interact with a D1 database - wrangler hyperdrive ๐Ÿš€ Configure Hyperdrive databases - wrangler ai ๐Ÿค– Interact with AI models - wrangler vectorize ๐Ÿงฎ Interact with Vectorize indexes - wrangler pubsub ๐Ÿ“ฎ Interact and manage Pub/Sub Brokers - wrangler mtls-certificate ๐Ÿชช Manage certificates used for mTLS connections - wrangler login ๐Ÿ”“ Login to Cloudflare - wrangler logout ๐Ÿšช Logout from Cloudflare - wrangler whoami ๐Ÿ•ต๏ธ Retrieve your user info and test your auth config - wrangler types [path] ๐Ÿ“ Generate types from bindings & module rules in config - wrangler deployments ๐Ÿšข List and view details for deployments - wrangler rollback [deployment-id] ๐Ÿ”™ Rollback a deployment - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" + COMMANDS + wrangler docs [command] ๐Ÿ“š Open the wrangler commands documentation in your browser + + wrangler init [name] ๐Ÿ“ฅ Initialize a basic Worker application + wrangler dev [script] ๐Ÿ‘‚ Start a local server for developing a Worker + wrangler deploy [script] ๐Ÿ†™ Deploy a Worker to Cloudflare [aliases: publish] + wrangler deployments ๐Ÿšข List and view the current and past deployments for your Worker [open beta] + wrangler rollback [deployment-id] ๐Ÿ”™ Rollback a deployment for a Worker [open beta] + wrangler delete [script] ๐Ÿ—‘ Delete a Worker from Cloudflare + wrangler tail [worker] ๐Ÿฆš Start a log tailing session for a Worker + wrangler secret ๐Ÿคซ Generate a secret that can be referenced in a Worker + wrangler types [path] ๐Ÿ“ Generate types from bindings and module rules in configuration + + wrangler kv ๐Ÿ—‚๏ธ Manage Workers KV Namespaces + wrangler queues ๐Ÿ‡ถ Manage Workers Queues + wrangler r2 ๐Ÿ“ฆ Manage R2 buckets & objects + wrangler d1 ๐Ÿ—„ Manage Workers D1 databases + wrangler vectorize ๐Ÿงฎ Manage Vectorize indexes [open beta] + wrangler hyperdrive ๐Ÿš€ Manage Hyperdrive databases + wrangler pages โšก๏ธ Configure Cloudflare Pages + wrangler mtls-certificate ๐Ÿชช Manage certificates used for mTLS connections + wrangler pubsub ๐Ÿ“ฎ Manage Pub/Sub brokers [private beta] + wrangler dispatch-namespace ๐Ÿ—๏ธ Manage dispatch namespaces + wrangler ai ๐Ÿค– Manage AI models + + wrangler login ๐Ÿ”“ Login to Cloudflare + wrangler logout ๐Ÿšช Logout from Cloudflare + wrangler whoami ๐Ÿ•ต๏ธ Retrieve your user information and test your authentication configuration + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean] + + Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose" `); }); @@ -55,23 +59,23 @@ describe("versions --help", () => { await expect(result).resolves.toBeUndefined(); expect(std.out).toMatchInlineSnapshot(` - "wrangler versions - - List, view, upload and deploy Versions of your Worker to Cloudflare [beta] - - Commands: - wrangler versions view View the details of a specific version of your Worker [beta] - wrangler versions list List the 10 most recent Versions of your Worker [beta] - wrangler versions upload Uploads your Worker code and config as a new Version [beta] - wrangler versions deploy [version-specs..] Safely roll out new Versions of your Worker by splitting traffic between multiple Versions [beta] - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + "wrangler versions + + ๐Ÿซง List, view, upload and deploy Versions of your Worker to Cloudflare [open beta] + + COMMANDS + wrangler versions view View the details of a specific version of your Worker [beta] + wrangler versions list List the 10 most recent Versions of your Worker [beta] + wrangler versions upload Uploads your Worker code and config as a new Version [beta] + wrangler versions deploy [version-specs..] Safely roll out new Versions of your Worker by splitting traffic between multiple Versions [beta] + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); }); @@ -93,23 +97,23 @@ describe("versions subhelp", () => { await setImmediate(); // wait for subhelp expect(std.out).toMatchInlineSnapshot(` - "wrangler versions - - List, view, upload and deploy Versions of your Worker to Cloudflare [beta] - - Commands: - wrangler versions view View the details of a specific version of your Worker [beta] - wrangler versions list List the 10 most recent Versions of your Worker [beta] - wrangler versions upload Uploads your Worker code and config as a new Version [beta] - wrangler versions deploy [version-specs..] Safely roll out new Versions of your Worker by splitting traffic between multiple Versions [beta] - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + "wrangler versions + + ๐Ÿซง List, view, upload and deploy Versions of your Worker to Cloudflare [open beta] + + COMMANDS + wrangler versions view View the details of a specific version of your Worker [beta] + wrangler versions list List the 10 most recent Versions of your Worker [beta] + wrangler versions upload Uploads your Worker code and config as a new Version [beta] + wrangler versions deploy [version-specs..] Safely roll out new Versions of your Worker by splitting traffic between multiple Versions [beta] + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); test("shows implicit subhelp with --x-versions flag", async () => { @@ -119,23 +123,23 @@ describe("versions subhelp", () => { await setImmediate(); // wait for subhelp expect(std.out).toMatchInlineSnapshot(` - "wrangler versions - - List, view, upload and deploy Versions of your Worker to Cloudflare [beta] - - Commands: - wrangler versions view View the details of a specific version of your Worker [beta] - wrangler versions list List the 10 most recent Versions of your Worker [beta] - wrangler versions upload Uploads your Worker code and config as a new Version [beta] - wrangler versions deploy [version-specs..] Safely roll out new Versions of your Worker by splitting traffic between multiple Versions [beta] - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + "wrangler versions + + ๐Ÿซง List, view, upload and deploy Versions of your Worker to Cloudflare [open beta] + + COMMANDS + wrangler versions view View the details of a specific version of your Worker [beta] + wrangler versions list List the 10 most recent Versions of your Worker [beta] + wrangler versions upload Uploads your Worker code and config as a new Version [beta] + wrangler versions deploy [version-specs..] Safely roll out new Versions of your Worker by splitting traffic between multiple Versions [beta] + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); test("shows implicit subhelp with --experimental-gradual-rollouts flag", async () => { @@ -145,22 +149,22 @@ describe("versions subhelp", () => { await setImmediate(); // wait for subhelp expect(std.out).toMatchInlineSnapshot(` - "wrangler versions - - List, view, upload and deploy Versions of your Worker to Cloudflare [beta] - - Commands: - wrangler versions view View the details of a specific version of your Worker [beta] - wrangler versions list List the 10 most recent Versions of your Worker [beta] - wrangler versions upload Uploads your Worker code and config as a new Version [beta] - wrangler versions deploy [version-specs..] Safely roll out new Versions of your Worker by splitting traffic between multiple Versions [beta] - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + "wrangler versions + + ๐Ÿซง List, view, upload and deploy Versions of your Worker to Cloudflare [open beta] + + COMMANDS + wrangler versions view View the details of a specific version of your Worker [beta] + wrangler versions list List the 10 most recent Versions of your Worker [beta] + wrangler versions upload Uploads your Worker code and config as a new Version [beta] + wrangler versions deploy [version-specs..] Safely roll out new Versions of your Worker by splitting traffic between multiple Versions [beta] + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); }); diff --git a/packages/wrangler/src/__tests__/worker-namespace.test.ts b/packages/wrangler/src/__tests__/worker-namespace.test.ts index 4d91bb6c231b..89b71c9449c1 100644 --- a/packages/wrangler/src/__tests__/worker-namespace.test.ts +++ b/packages/wrangler/src/__tests__/worker-namespace.test.ts @@ -26,30 +26,30 @@ describe("dispatch-namespace", () => { await new Promise((resolve) => setImmediate(resolve)); expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "", - "out": "wrangler dispatch-namespace - - ๐Ÿ“ฆ Interact with a dispatch namespace - - Commands: - wrangler dispatch-namespace list List all dispatch namespaces - wrangler dispatch-namespace get Get information about a dispatch namespace - wrangler dispatch-namespace create Create a dispatch namespace - wrangler dispatch-namespace delete Delete a dispatch namespace - wrangler dispatch-namespace rename Rename a dispatch namespace - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]", - "warn": "", - } - `); + Object { + "debug": "", + "err": "", + "info": "", + "out": "wrangler dispatch-namespace + + ๐Ÿ—๏ธ Manage dispatch namespaces + + COMMANDS + wrangler dispatch-namespace list List all dispatch namespaces + wrangler dispatch-namespace get Get information about a dispatch namespace + wrangler dispatch-namespace create Create a dispatch namespace + wrangler dispatch-namespace delete Delete a dispatch namespace + wrangler dispatch-namespace rename Rename a dispatch namespace + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]", + "warn": "", + } + `); }); describe("create namespace", () => { @@ -86,21 +86,21 @@ describe("dispatch-namespace", () => { ); expect(std.out).toMatchInlineSnapshot(` - " - wrangler dispatch-namespace create + " + wrangler dispatch-namespace create - Create a dispatch namespace + Create a dispatch namespace - Positionals: - name Name of the dispatch namespace [string] [required] + POSITIONALS + name Name of the dispatch namespace [string] [required] - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); it("should attempt to create the given namespace", async () => { @@ -137,21 +137,21 @@ describe("dispatch-namespace", () => { ); expect(std.out).toMatchInlineSnapshot(` - " - wrangler dispatch-namespace create + " + wrangler dispatch-namespace create - Create a dispatch namespace + Create a dispatch namespace - Positionals: - name Name of the dispatch namespace [string] [required] + POSITIONALS + name Name of the dispatch namespace [string] [required] - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); it("should try to delete the given namespace", async () => { @@ -197,21 +197,21 @@ describe("dispatch-namespace", () => { ); expect(std.out).toMatchInlineSnapshot(` - " - wrangler dispatch-namespace get + " + wrangler dispatch-namespace get - Get information about a dispatch namespace + Get information about a dispatch namespace - Positionals: - name Name of the dispatch namespace [string] [required] + POSITIONALS + name Name of the dispatch namespace [string] [required] - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); it("should attempt to get info for the given namespace", async () => { @@ -307,22 +307,22 @@ describe("dispatch-namespace", () => { ); expect(std.out).toMatchInlineSnapshot(` - " - wrangler dispatch-namespace rename - - Rename a dispatch namespace - - Positionals: - old-name Name of the dispatch namespace [string] [required] - new-name New name of the dispatch namespace [string] [required] - - Flags: - -j, --experimental-json-config Experimental: Support wrangler.json [boolean] - -c, --config Path to .toml configuration file [string] - -e, --env Environment to use for operations and .env files [string] - -h, --help Show help [boolean] - -v, --version Show version number [boolean]" - `); + " + wrangler dispatch-namespace rename + + Rename a dispatch namespace + + POSITIONALS + old-name Name of the dispatch namespace [string] [required] + new-name New name of the dispatch namespace [string] [required] + + GLOBAL FLAGS + -j, --experimental-json-config โš‘ Experimental: support wrangler.json [boolean] + -c, --config โš‘ Path to .toml configuration file [string] + -e, --env โš‘ Environment to use for operations and .env files [string] + -h, --help โš‘ Show help [boolean] + -v, --version โš‘ Show version number [boolean]" + `); }); it("should attempt to rename the given namespace", async () => { diff --git a/packages/wrangler/src/d1/index.ts b/packages/wrangler/src/d1/index.ts index 00f793323cd2..43b22f169f87 100644 --- a/packages/wrangler/src/d1/index.ts +++ b/packages/wrangler/src/d1/index.ts @@ -16,7 +16,7 @@ export function d1(yargs: CommonYargsArgv) { .command("list", "List D1 databases", List.Options, List.Handler) .command( "info ", - "Get information about a D1 database, including the current database size and state.", + "Get information about a D1 database, including the current database size and state", Info.Options, Info.Handler ) @@ -38,7 +38,7 @@ export function d1(yargs: CommonYargsArgv) { Delete.Options, Delete.Handler ) - .command("backup", "Interact with D1 Backups", (backupArgs) => + .command("backup", "Interact with D1 backups", (backupArgs) => backupArgs .demandCommand() .command( @@ -82,7 +82,7 @@ export function d1(yargs: CommonYargsArgv) { // ) .command( "execute ", - "Executed command or SQL file", + "Execute a command or SQL file", Execute.Options, Execute.Handler ) @@ -94,24 +94,24 @@ export function d1(yargs: CommonYargsArgv) { ) .command( "time-travel", - "Use Time Travel to restore, fork or copy a database at a specific point-in-time.", + "Use Time Travel to restore, fork or copy a database at a specific point-in-time", (yargs2) => yargs2 .demandCommand() .command( "info ", - "Retrieve information about a database at a specific point-in-time using Time Travel.", + "Retrieve information about a database at a specific point-in-time using Time Travel", TimeTravel.InfoOptions, TimeTravel.InfoHandler ) .command( "restore ", - "Restore a database back to a specific point-in-time.", + "Restore a database back to a specific point-in-time", TimeTravel.RestoreOptions, TimeTravel.RestoreHandler ) ) - .command("migrations", "Interact with D1 Migrations", (yargs2) => + .command("migrations", "Interact with D1 migrations", (yargs2) => yargs2 .demandCommand() .command( @@ -122,13 +122,13 @@ export function d1(yargs: CommonYargsArgv) { ) .command( "create ", - "Create a new Migration", + "Create a new migration", Migrations.CreateOptions, Migrations.CreateHandler ) .command( "apply ", - "Apply D1 Migrations", + "Apply D1 migrations", Migrations.ApplyOptions, Migrations.ApplyHandler ) diff --git a/packages/wrangler/src/index.ts b/packages/wrangler/src/index.ts index 8ee07c5d1d76..a54e9cb9cc7f 100644 --- a/packages/wrangler/src/index.ts +++ b/packages/wrangler/src/index.ts @@ -66,6 +66,7 @@ import { logout, validateScopeKeys, } from "./user"; +import { embolden, highlight } from "./utils/stdout-styling"; import { vectorize } from "./vectorize/index"; import registerVersionsSubcommands from "./versions"; import registerVersionsDeploymentsSubcommands from "./versions/deployments"; @@ -79,6 +80,8 @@ import type { Arguments } from "yargs"; const resetColor = "\x1b[0m"; const fgGreenColor = "\x1b[32m"; +const betaCmdColor = "#BD5B08"; + export const DEFAULT_LOCAL_PORT = 8787; export const DEFAULT_INSPECTOR_PORT = 9229; @@ -139,7 +142,8 @@ export function getScriptName( } /** - * Alternative to the getScriptName() because special Legacy cases allowed "name", and "env" together in Wrangler v1 + * Alternative to the getScriptName() because special Legacy cases allowed + * "name", and "env" together in Wrangler v1 */ export function getLegacyScriptName( args: { name: string | undefined; env: string | undefined }, @@ -150,8 +154,10 @@ export function getLegacyScriptName( : args.name ?? config.name; } -// a helper to demand one of a set of options -// via https://github.com/yargs/yargs/issues/1093#issuecomment-491299261 +/** + * A helper to demand one of a set of options + * via https://github.com/yargs/yargs/issues/1093#issuecomment-491299261 + */ export function demandOneOfOption(...options: string[]) { return function (argv: Arguments) { const count = options.filter((option) => argv[option]).length; @@ -204,33 +210,34 @@ export function createCLIParser(argv: string[]) { }) .scriptName("wrangler") .wrap(null) + .locale("en_US") // Define global options here, so they get included in the `Argv` type of // the `wrangler` variable .version(false) .option("v", { - describe: "Show version number", + describe: "โš‘ Show version number", alias: "version", type: "boolean", }) .option("config", { alias: "c", - describe: "Path to .toml configuration file", + describe: "โš‘ Path to .toml configuration file", type: "string", requiresArg: true, }) .option("env", { alias: "e", - describe: "Environment to use for operations and .env files", + describe: "โš‘ Environment to use for operations and .env files", type: "string", requiresArg: true, }) .option("experimental-json-config", { alias: "j", - describe: `Experimental: Support wrangler.json`, + describe: `โš‘ Experimental: support wrangler.json`, type: "boolean", }) .option("experimental-versions", { - describe: `Experimental: Support Worker Versions`, + describe: `โš‘ Experimental: support Worker Versions`, type: "boolean", hidden: true, alias: ["x-versions", "experimental-gradual-rollouts"], @@ -249,13 +256,24 @@ export function createCLIParser(argv: string[]) { } } return true; - }); + }) + .epilogue( + `Please report any issues to ${highlight( + "https://github.com/cloudflare/workers-sdk/issues/new/choose", + "#3B818D" + )}` + ); + wrangler.updateStrings({ + "Commands:": `${embolden("COMMANDS")}`, + "Options:": `${embolden("OPTIONS")}`, + "Positionals:": `${embolden("POSITIONALS")}`, + }); wrangler.group( ["experimental-json-config", "config", "env", "help", "version"], - "Flags:" + `${embolden("GLOBAL FLAGS")}` ); - wrangler.help().alias("h", "help"); + wrangler.help("help", "โš‘ Show help").alias("h", "help"); // Default help command that supports the subcommands const subHelp: SubHelp = { @@ -290,47 +308,45 @@ export function createCLIParser(argv: string[]) { } ); - // You will note that we use the form for all commands where we use the builder function - // to define options and subcommands. - // Further we return the result of this builder even though it's not completely necessary. - // The reason is that it's required for type inference of the args in the handle function. - // I wish we could enforce this pattern, but this comment will have to do for now. - // (It's also annoying that choices[] doesn't get inferred as an enum. ๐Ÿคทโ€โ™‚.) - + /* + * You will note that we use the form for all commands where we use the builder function + * to define options and subcommands. + * Further we return the result of this builder even though it's not completely necessary. + * The reason is that it's required for type inference of the args in the handle function. + * I wish we could enforce this pattern, but this comment will have to do for now. + * (It's also annoying that choices[] doesn't get inferred as an enum. ๐Ÿคทโ€โ™‚.) + */ + /* + * TODO: Implement proper command grouping if yargs will ever support it + * (see https://github.com/yargs/yargs/issues/684) + * Until then, use a new line in the command description whenever we want + * to create some logical spacing between commands. This is hacky but + * ยฏ\_(ใƒ„)_/ยฏ + */ + /******************************************************/ + /* WRANGLER COMMANDS */ + /******************************************************/ // docs wrangler.command( - "docs [command..]", - "๐Ÿ“š Open wrangler's docs in your browser", + "docs [command]", + "๐Ÿ“š Open the wrangler commands documentation in your browser\n", docsOptions, docsHandler ); + /******************** CMD GROUP ***********************/ // init wrangler.command( "init [name]", - "๐Ÿ“ฅ Initialize a basic Worker project, including a wrangler.toml file", + "๐Ÿ“ฅ Initialize a basic Worker application", initOptions, initHandler ); - // generate - wrangler.command( - "generate [name] [template]", - "โœจ Generate a new Worker project from an existing Worker template. See https://github.com/cloudflare/workers-sdk/tree/main/templates", - generateOptions, - generateHandler - ); - - // [DEPRECATED] build - wrangler.command("build", false, buildOptions, buildHandler); - - // [DEPRECATED] config - wrangler.command("config", false, noOpOptions, configHandler); - // dev wrangler.command( "dev [script]", - "๐Ÿ‘‚ Start a local server for developing your worker", + "๐Ÿ‘‚ Start a local server for developing a Worker", devOptions, devHandler ); @@ -338,15 +354,150 @@ export function createCLIParser(argv: string[]) { // deploy wrangler.command( ["deploy [script]", "publish [script]"], - "๐Ÿ†™ Deploy your Worker to Cloudflare.", + "๐Ÿ†™ Deploy a Worker to Cloudflare", deployOptions, deployHandler ); + // [OPEN BETA] deployments + const deploymentsWarning = + "๐Ÿšง`wrangler deployments` is a beta command. Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose"; + const deploymentsDescription = `๐Ÿšข List and view the current and past deployments for your Worker ${highlight("[open beta]", betaCmdColor)}`; + + if (experimentalGradualRollouts) { + wrangler + .command( + "deployments", + deploymentsDescription, + registerVersionsDeploymentsSubcommands + ) + .command(subHelp) + .epilogue(deploymentsWarning); + } else { + wrangler.command("deployments", deploymentsDescription, (yargs) => + yargs + .option("name", { + describe: "The name of your Worker", + type: "string", + }) + .command( + "list", + "Displays the 10 most recent deployments for a Worker", + async (listYargs) => listYargs, + async (listYargs) => { + const { accountId, scriptName, config } = + await commonDeploymentCMDSetup(listYargs, deploymentsWarning); + await deployments(accountId, scriptName, config); + } + ) + .command( + "view [deployment-id]", + "View a deployment", + async (viewYargs) => + viewYargs.positional("deployment-id", { + describe: "The ID of the deployment you want to inspect", + type: "string", + demandOption: false, + }), + async (viewYargs) => { + const { accountId, scriptName, config } = + await commonDeploymentCMDSetup(viewYargs, deploymentsWarning); + + await viewDeployment( + accountId, + scriptName, + config, + viewYargs.deploymentId + ); + } + ) + .command(subHelp) + .epilogue(deploymentsWarning) + ); + } + + // [OPEN BETA] rollback + const rollbackWarning = + "๐Ÿšง`wrangler rollback` is a beta command. Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose"; + const rollbackDescription = `๐Ÿ”™ Rollback a deployment for a Worker ${highlight("[open beta]", betaCmdColor)}`; + + if (experimentalGradualRollouts) { + registerVersionsRollbackCommand( + wrangler, + rollbackWarning, + subHelp, + rollbackDescription + ); + } else { + wrangler.command( + "rollback [deployment-id]", + rollbackDescription, + (rollbackYargs) => + rollbackYargs + .positional("deployment-id", { + describe: "The ID of the deployment to rollback to", + type: "string", + demandOption: false, + }) + .option("message", { + alias: "m", + describe: + "Skip confirmation and message prompts, uses provided argument as message", + type: "string", + default: undefined, + }) + .option("name", { + describe: "The name of your Worker", + type: "string", + }) + .epilogue(rollbackWarning), + async (rollbackYargs) => { + const { accountId, scriptName, config } = + await commonDeploymentCMDSetup(rollbackYargs, rollbackWarning); + + await rollbackDeployment( + accountId, + scriptName, + config, + rollbackYargs.deploymentId, + rollbackYargs.message + ); + } + ); + } + + // [OPEN BETA] versions + if (experimentalGradualRollouts) { + wrangler.command( + "versions", + `๐Ÿซง List, view, upload and deploy Versions of your Worker to Cloudflare ${highlight( + "[open beta]", + betaCmdColor + )}`, + (yargs) => { + return registerVersionsSubcommands(yargs.command(subHelp)); + } + ); + } + + // [OPEN BETA] triggers + if (experimentalGradualRollouts) { + wrangler.command( + "triggers", + `๐ŸŽฏ Updates the triggers of your current deployment ${highlight( + "[open beta]", + betaCmdColor + )}`, + (yargs) => { + return registerTriggersSubcommands(yargs.command(subHelp)); + } + ); + } + // delete wrangler.command( "delete [script]", - "๐Ÿ—‘ Delete your Worker from Cloudflare.", + "๐Ÿ—‘ Delete a Worker from Cloudflare", deleteOptions, deleteHandler ); @@ -354,39 +505,11 @@ export function createCLIParser(argv: string[]) { // tail wrangler.command( "tail [worker]", - "๐Ÿฆš Starts a log tailing session for a published Worker.", + "๐Ÿฆš Start a log tailing session for a Worker", tailOptions, tailHandler ); - // [DEPRECATED] preview - wrangler.command( - "preview [method] [body]", - false, - previewOptions, - previewHandler - ); - - // [DEPRECATED] route - wrangler.command( - "route", - false, // I think we want to hide this command - // "โžก๏ธ List or delete worker routes", - (routeYargs) => { - return route(routeYargs); - }, - routeHandler - ); - - // [DEPRECATED] subdomain - wrangler.command( - "subdomain [name]", - false, - // "๐Ÿ‘ท Create or change your workers.dev subdomain.", - subdomainOptions, - subdomainHandler - ); - // secret wrangler.command( "secret", @@ -396,150 +519,100 @@ export function createCLIParser(argv: string[]) { } ); - // [DEPRECATED] secret:bulk + // types wrangler.command( - "secret:bulk [json]", - false, - secretBulkOptions, - secretBulkHandler + "types [path]", + "๐Ÿ“ Generate types from bindings and module rules in configuration\n", + typesOptions, + typesHandler ); + /******************** CMD GROUP ***********************/ // kv - wrangler.command( - "kv", - `๐Ÿ—‚๏ธ Interact with your Workers KV Namespaces`, - (kvYargs) => { - return registerKvSubcommands(kvYargs, subHelp); - } - ); - - // [DEPRECATED] kv namespace - wrangler.command( - "kv:namespace", - false, // deprecated, don't show - (namespaceYargs) => { - logger.warn( - "The `wrangler kv:namespace` command is deprecated and will be removed in a future major version. Please use `wrangler kv namespace` instead which behaves the same." - ); - - return kvNamespace(namespaceYargs.command(subHelp)); - } - ); - - // [DEPRECATED] kv key - wrangler.command( - "kv:key", - false, // deprecated, don't show - (keyYargs) => { - logger.warn( - "The `wrangler kv:key` command is deprecated and will be removed in a future major version. Please use `wrangler kv key` instead which behaves the same." - ); - - return kvKey(keyYargs.command(subHelp)); - } - ); - - // [DEPRECATED] kv bulk - wrangler.command( - "kv:bulk", - false, // deprecated, don't show - (bulkYargs) => { - logger.warn( - "The `wrangler kv:bulk` command is deprecated and will be removed in a future major version. Please use `wrangler kv bulk` instead which behaves the same." - ); - - return kvBulk(bulkYargs.command(subHelp)); - } - ); - - // pages - wrangler.command("pages", "โšก๏ธ Configure Cloudflare Pages", (pagesYargs) => { - // Pages does not support the `--config`, `--experimental-json-config`, - // and `--env` flags, therefore hiding them from the global flags list. - pagesYargs.hide("config").hide("env").hide("experimental-json-config"); - - return pages(pagesYargs, subHelp); + wrangler.command("kv", `๐Ÿ—‚๏ธ Manage Workers KV Namespaces`, (kvYargs) => { + return registerKvSubcommands(kvYargs, subHelp); }); // queues - wrangler.command("queues", "๐Ÿ‡ถ Configure Workers Queues", (queuesYargs) => { + wrangler.command("queues", "๐Ÿ‡ถ Manage Workers Queues", (queuesYargs) => { return queues(queuesYargs.command(subHelp)); }); // r2 - wrangler.command("r2", "๐Ÿ“ฆ Interact with an R2 store", (r2Yargs) => { + wrangler.command("r2", "๐Ÿ“ฆ Manage R2 buckets & objects", (r2Yargs) => { return r2(r2Yargs.command(subHelp)); }); - // dispatch-namespace - wrangler.command( - "dispatch-namespace", - "๐Ÿ“ฆ Interact with a dispatch namespace", - (workerNamespaceYargs) => { - return workerNamespaceCommands(workerNamespaceYargs, subHelp); - } - ); - // d1 - wrangler.command("d1", "๐Ÿ—„ Interact with a D1 database", (d1Yargs) => { + wrangler.command("d1", `๐Ÿ—„ Manage Workers D1 databases`, (d1Yargs) => { return d1(d1Yargs.command(subHelp)); }); + // [OPEN BETA] vectorize + wrangler.command( + "vectorize", + `๐Ÿงฎ Manage Vectorize indexes ${highlight("[open beta]", betaCmdColor)}`, + (vectorYargs) => { + return vectorize(vectorYargs.command(subHelp)); + } + ); + // hyperdrive wrangler.command( "hyperdrive", - "๐Ÿš€ Configure Hyperdrive databases", + "๐Ÿš€ Manage Hyperdrive databases", (hyperdriveYargs) => { return hyperdrive(hyperdriveYargs.command(subHelp)); } ); - // ai - wrangler.command("ai", "๐Ÿค– Interact with AI models", (aiYargs) => { - return ai(aiYargs.command(subHelp)); - }); - - // cloudchamber - wrangler.command("cloudchamber", false, (cloudchamberArgs) => { - return cloudchamber(asJson(cloudchamberArgs.command(subHelp)), subHelp); - }); + // pages + wrangler.command("pages", "โšก๏ธ Configure Cloudflare Pages", (pagesYargs) => { + // Pages does not support the `--config`, `--experimental-json-config`, + // and `--env` flags, therefore hiding them from the global flags list. + pagesYargs.hide("config").hide("env").hide("experimental-json-config"); - // [DEPRECATED] constellation - wrangler.command("constellation", false, (aiYargs) => { - return constellation(aiYargs.command(subHelp)); + return pages(pagesYargs, subHelp); }); - // vectorize + // mtls-certificate wrangler.command( - "vectorize", - "๐Ÿงฎ Interact with Vectorize indexes", - (vectorYargs) => { - return vectorize(vectorYargs.command(subHelp)); + "mtls-certificate", + "๐Ÿชช Manage certificates used for mTLS connections", + (mtlsYargs) => { + return mTlsCertificateCommands(mtlsYargs.command(subHelp)); } ); - // pubsub + // cloudchamber + wrangler.command("cloudchamber", false, (cloudchamberArgs) => { + return cloudchamber(asJson(cloudchamberArgs.command(subHelp)), subHelp); + }); + + // [PRIVATE BETA] pubsub wrangler.command( "pubsub", - "๐Ÿ“ฎ Interact and manage Pub/Sub Brokers", + `๐Ÿ“ฎ Manage Pub/Sub brokers ${highlight("[private beta]", betaCmdColor)}`, (pubsubYargs) => { return pubSubCommands(pubsubYargs, subHelp); } ); - // mtls-certificate + // dispatch-namespace wrangler.command( - "mtls-certificate", - "๐Ÿชช Manage certificates used for mTLS connections", - (mtlsYargs) => { - return mTlsCertificateCommands(mtlsYargs.command(subHelp)); + "dispatch-namespace", + "๐Ÿ—๏ธ Manage dispatch namespaces", + (workerNamespaceYargs) => { + return workerNamespaceCommands(workerNamespaceYargs, subHelp); } ); - /** - * User Group: login, logout, and whoami - * TODO: group commands into User group similar to .group() for flags in yargs - */ + // ai + wrangler.command("ai", "๐Ÿค– Manage AI models\n", (aiYargs) => { + return ai(aiYargs.command(subHelp)); + }); + + /******************** CMD GROUP ***********************/ // login wrangler.command( // this needs scopes as an option? @@ -563,7 +636,6 @@ export function createCLIParser(argv: string[]) { type: "string", requiresArg: true, }); - // TODO: scopes }, async (args) => { @@ -617,7 +689,7 @@ export function createCLIParser(argv: string[]) { // whoami wrangler.command( "whoami", - "๐Ÿ•ต๏ธ Retrieve your user info and test your auth config", + "๐Ÿ•ต๏ธ Retrieve your user information and test your authentication configuration", () => {}, async (args) => { await printWranglerBanner(); @@ -629,118 +701,107 @@ export function createCLIParser(argv: string[]) { } ); - // type generation + /******************************************************/ + /* DEPRECATED COMMANDS */ + /******************************************************/ + // [DEPRECATED] build + wrangler.command("build", false, buildOptions, buildHandler); + + // [DEPRECATED] config + wrangler.command("config", false, noOpOptions, configHandler); + + // [DEPRECATED] preview wrangler.command( - "types [path]", - "๐Ÿ“ Generate types from bindings & module rules in config", - typesOptions, - typesHandler + "preview [method] [body]", + false, + previewOptions, + previewHandler ); - //deployments - const deploymentsWarning = - "๐Ÿšง`wrangler deployments` is a beta command. Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose"; - if (experimentalGradualRollouts) { - wrangler - .command( - "deployments", - "List and view the current and past deployments for your Worker", - registerVersionsDeploymentsSubcommands - ) - .command(subHelp) - .epilogue(deploymentsWarning); - } else { - wrangler.command( - "deployments", - "๐Ÿšข List and view details for deployments", - (yargs) => - yargs - .option("name", { - describe: "The name of your worker", - type: "string", - }) - .command( - "list", - "๐Ÿšข Displays the 10 most recent deployments for a worker", - async (listYargs) => listYargs, - async (listYargs) => { - const { accountId, scriptName, config } = - await commonDeploymentCMDSetup(listYargs, deploymentsWarning); - await deployments(accountId, scriptName, config); - } - ) - .command( - "view [deployment-id]", - "๐Ÿ” View a deployment", - async (viewYargs) => - viewYargs.positional("deployment-id", { - describe: "The ID of the deployment you want to inspect", - type: "string", - demandOption: false, - }), - async (viewYargs) => { - const { accountId, scriptName, config } = - await commonDeploymentCMDSetup(viewYargs, deploymentsWarning); - - await viewDeployment( - accountId, - scriptName, - config, - viewYargs.deploymentId - ); - } - ) - .command(subHelp) - .epilogue(deploymentsWarning) - ); - } + // [DEPRECATED] route + wrangler.command( + "route", + false, // I think we want to hide this command + // "โžก๏ธ List or delete worker routes", + (routeYargs) => { + return route(routeYargs); + }, + routeHandler + ); - const rollbackWarning = - "๐Ÿšง`wrangler rollback` is a beta command. Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose"; - if (experimentalGradualRollouts) { - registerVersionsRollbackCommand(wrangler, rollbackWarning, subHelp); - } else { - wrangler.command( - "rollback [deployment-id]", - "๐Ÿ”™ Rollback a deployment", - (rollbackYargs) => - rollbackYargs - .positional("deployment-id", { - describe: "The ID of the deployment to rollback to", - type: "string", - demandOption: false, - }) - .option("message", { - alias: "m", - describe: - "Skip confirmation and message prompts, uses provided argument as message", - type: "string", - default: undefined, - }) - .option("name", { - describe: "The name of your worker", - type: "string", - }) - .epilogue(rollbackWarning), - async (rollbackYargs) => { - const { accountId, scriptName, config } = - await commonDeploymentCMDSetup(rollbackYargs, rollbackWarning); + // [DEPRECATED] subdomain + wrangler.command( + "subdomain [name]", + false, + // "๐Ÿ‘ท Create or change your workers.dev subdomain.", + subdomainOptions, + subdomainHandler + ); - await rollbackDeployment( - accountId, - scriptName, - config, - rollbackYargs.deploymentId, - rollbackYargs.message - ); - } - ); - } + // [DEPRECATED] constellation + wrangler.command("constellation", false, (aiYargs) => { + return constellation(aiYargs.command(subHelp)); + }); + + // [DEPRECATED] secret:bulk + wrangler.command( + "secret:bulk [json]", + false, + secretBulkOptions, + secretBulkHandler + ); + + // [DEPRECATED] kv:namespace + wrangler.command( + "kv:namespace", + false, // deprecated, don't show + (namespaceYargs) => { + logger.warn( + "The `wrangler kv:namespace` command is deprecated and will be removed in a future major version. Please use `wrangler kv namespace` instead which behaves the same." + ); + + return kvNamespace(namespaceYargs.command(subHelp)); + } + ); + + // [DEPRECATED] kv:key + wrangler.command( + "kv:key", + false, // deprecated, don't show + (keyYargs) => { + logger.warn( + "The `wrangler kv:key` command is deprecated and will be removed in a future major version. Please use `wrangler kv key` instead which behaves the same." + ); + + return kvKey(keyYargs.command(subHelp)); + } + ); + + // [DEPRECATED] kv:bulk + wrangler.command( + "kv:bulk", + false, // deprecated, don't show + (bulkYargs) => { + logger.warn( + "The `wrangler kv:bulk` command is deprecated and will be removed in a future major version. Please use `wrangler kv bulk` instead which behaves the same." + ); + + return kvBulk(bulkYargs.command(subHelp)); + } + ); + + // [DEPRECATED] generate + wrangler.command( + "generate [name] [template]", + false, + generateOptions, + generateHandler + ); // This set to false to allow overwrite of default behaviour wrangler.version(false); - // version (DEPRECATED) + // [DEPRECATED] version wrangler.command( "version", false, @@ -758,28 +819,6 @@ export function createCLIParser(argv: string[]) { } ); - // versions - if (experimentalGradualRollouts) { - wrangler.command( - "versions", - "List, view, upload and deploy Versions of your Worker to Cloudflare [beta]", - (yargs) => { - return registerVersionsSubcommands(yargs.command(subHelp)); - } - ); - } - - // triggers - if (experimentalGradualRollouts) { - wrangler.command( - "triggers", - "Updates the triggers of your current deployment [beta]", - (yargs) => { - return registerTriggersSubcommands(yargs.command(subHelp)); - } - ); - } - wrangler.exitProcess(false); return wrangler; diff --git a/packages/wrangler/src/kv/index.ts b/packages/wrangler/src/kv/index.ts index 4947e1b42f4b..ffa4955ee86b 100644 --- a/packages/wrangler/src/kv/index.ts +++ b/packages/wrangler/src/kv/index.ts @@ -40,21 +40,21 @@ export function registerKvSubcommands( return kvYargs .command( "namespace", - `๐Ÿ—‚๏ธ Interact with your Workers KV Namespaces`, + `Interact with your Workers KV Namespaces`, (namespaceYargs) => { return kvNamespace(namespaceYargs.command(subHelp)); } ) .command( "key", - `๐Ÿ”‘ Individually manage Workers KV key-value pairs`, + `Individually manage Workers KV key-value pairs`, (keyYargs) => { return kvKey(keyYargs.command(subHelp)); } ) .command( "bulk", - `๐Ÿ’ช Interact with multiple Workers KV key-value pairs at once`, + `Interact with multiple Workers KV key-value pairs at once`, (bulkYargs) => { return kvBulk(bulkYargs.command(subHelp)); } @@ -118,7 +118,7 @@ export function kvNamespace(kvYargs: CommonYargsArgv) { ) .command( "list", - "Outputs a list of all KV namespaces associated with your account id.", + "Output a list of all KV namespaces associated with your account id", (listArgs) => listArgs, async (args) => { const config = readConfig(args.config, args); @@ -137,7 +137,7 @@ export function kvNamespace(kvYargs: CommonYargsArgv) { ) .command( "delete", - "Deletes a given namespace.", + "Delete a given namespace.", (yargs) => { return yargs .option("binding", { @@ -203,7 +203,7 @@ export const kvKey = (kvYargs: CommonYargsArgv) => { return kvYargs .command( "put [value]", - "Writes a single key/value pair to the given namespace.", + "Write a single key/value pair to the given namespace", (yargs) => { return yargs .positional("key", { @@ -322,7 +322,7 @@ export const kvKey = (kvYargs: CommonYargsArgv) => { ) .command( "list", - "Outputs a list of all keys in a given namespace.", + "Output a list of all keys in a given namespace", (yargs) => { return yargs .option("binding", { @@ -388,7 +388,7 @@ export const kvKey = (kvYargs: CommonYargsArgv) => { ) .command( "get ", - "Reads a single value by key from the given namespace.", + "Read a single value by key from the given namespace", (yargs) => { return yargs .positional("key", { @@ -478,7 +478,7 @@ export const kvKey = (kvYargs: CommonYargsArgv) => { ) .command( "delete ", - "Removes a single key value pair from the given namespace.", + "Remove a single key value pair from the given namespace", (yargs) => { return yargs .positional("key", { diff --git a/packages/wrangler/src/pages/index.ts b/packages/wrangler/src/pages/index.ts index b7ffe41232ee..f67b6b7c3389 100644 --- a/packages/wrangler/src/pages/index.ts +++ b/packages/wrangler/src/pages/index.ts @@ -30,7 +30,7 @@ export function pages(yargs: CommonYargsArgv, subHelp: SubHelp) { .command(subHelp) .command( "dev [directory] [-- command..]", - "๐Ÿง‘โ€๐Ÿ’ป Develop your full-stack Pages application locally", + "Develop your full-stack Pages application locally", Dev.Options, Dev.Handler ) @@ -60,7 +60,7 @@ export function pages(yargs: CommonYargsArgv, subHelp: SubHelp) { Functions.OptimizeRoutesHandler ) ) - .command("project", "โšก๏ธ Interact with your Pages projects", (args) => + .command("project", "Interact with your Pages projects", (args) => args .command(subHelp) .command( @@ -91,7 +91,7 @@ export function pages(yargs: CommonYargsArgv, subHelp: SubHelp) { ) .command( "deployment", - "๐Ÿš€ Interact with the deployments of a project", + "Interact with the deployments of a project", (args) => args .command(subHelp) @@ -103,7 +103,7 @@ export function pages(yargs: CommonYargsArgv, subHelp: SubHelp) { ) .command( "create [directory]", - "๐Ÿ†™ Publish a directory of static assets as a Pages deployment", + "Publish a directory of static assets as a Pages deployment", Deploy.Options, Deploy.Handler ) @@ -117,16 +117,16 @@ export function pages(yargs: CommonYargsArgv, subHelp: SubHelp) { ) .command( ["deploy [directory]", "publish [directory]"], - "๐Ÿ†™ Deploy a directory of static assets as a Pages deployment", + "Deploy a directory of static assets as a Pages deployment", Deploy.Options, Deploy.Handler ) .command( "secret", - "๐Ÿคซ Generate a secret that can be referenced in a Pages project", + "Generate a secret that can be referenced in a Pages project", (secretYargs) => secret(secretYargs, subHelp) ) - .command("download", "โšก๏ธ Download settings from your project", (args) => + .command("download", "Download settings from your project", (args) => args.command( "config [projectName]", "Experimental: Download your Pages project config as a wrangler.toml file", diff --git a/packages/wrangler/src/queues/cli/commands/index.ts b/packages/wrangler/src/queues/cli/commands/index.ts index 13ab2699b2e1..2da413fe30ca 100644 --- a/packages/wrangler/src/queues/cli/commands/index.ts +++ b/packages/wrangler/src/queues/cli/commands/index.ts @@ -24,7 +24,7 @@ export function queues(yargs: CommonYargsArgv) { yargs.command( "consumer", - "Configure Queue Consumers", + "Configure Queue consumers", async (consumersYargs) => { await consumers(consumersYargs); } diff --git a/packages/wrangler/src/secret/index.ts b/packages/wrangler/src/secret/index.ts index 3b440327d88c..a8a43c792483 100644 --- a/packages/wrangler/src/secret/index.ts +++ b/packages/wrangler/src/secret/index.ts @@ -313,7 +313,7 @@ export const secret = (secretYargs: CommonYargsArgv) => { ) .command( "bulk [json]", - "๐Ÿ—„๏ธ Bulk upload secrets for a Worker", + "Bulk upload secrets for a Worker", secretBulkOptions, secretBulkHandler ); diff --git a/packages/wrangler/src/utils/stdout-styling.ts b/packages/wrangler/src/utils/stdout-styling.ts new file mode 100644 index 000000000000..3b45789209e8 --- /dev/null +++ b/packages/wrangler/src/utils/stdout-styling.ts @@ -0,0 +1,17 @@ +import chalk from "chalk"; +import supportsColor from "supports-color"; + +/** + * Terminal styling util function that sets text color. If terminal does + * not support colors, it will return the unchanged text instead. + */ +export function highlight(text: string, colorHex: string): string { + return supportsColor.stdout ? chalk.hex(colorHex)(text) : text; +} + +/** + * Terminal styling util function that makes text bold. + */ +export function embolden(text: string): string { + return chalk.bold(text); +} diff --git a/packages/wrangler/src/versions/deployments/index.ts b/packages/wrangler/src/versions/deployments/index.ts index 9eced0a404c9..1707f444e40d 100644 --- a/packages/wrangler/src/versions/deployments/index.ts +++ b/packages/wrangler/src/versions/deployments/index.ts @@ -18,13 +18,13 @@ export default function registerVersionsDeploymentsSubcommands( versionDeploymentsYargs .command( "list", - "Displays the 10 most recent deployments of your Worker [beta]", + "Displays the 10 most recent deployments of your Worker", versionsDeploymentsListOptions, versionsDeploymentsListHandler ) .command( "status", - "See the current state of your production [beta]", + "View the current state of your production", versionsDeploymentsStatusOptions, versionsDeploymentsStatusHandler ) diff --git a/packages/wrangler/src/versions/rollback/index.ts b/packages/wrangler/src/versions/rollback/index.ts index 570a8e8c51d5..6622ac07a6f9 100644 --- a/packages/wrangler/src/versions/rollback/index.ts +++ b/packages/wrangler/src/versions/rollback/index.ts @@ -19,12 +19,13 @@ export type VersionsRollbackArgs = StrictYargsOptionsToInterface< export default function registerVersionsRollbackCommand( yargs: CommonYargsArgv, epilogue: string, - subHelp: SubHelp + subHelp: SubHelp, + description = "๐Ÿ”™ Rollback to a Worker Version" ) { return yargs .command( "rollback [version-id]", - "๐Ÿ”™ Rollback to a Worker Version", + description, versionsRollbackOptions, versionsRollbackHandler )