Skip to content

Commit

Permalink
Rename kv:* commands (#5989)
Browse files Browse the repository at this point in the history
* rename `kv:*` commands to `kv *`
and deprecate the former

* add changeset

* hide kv:* commands from help text

* update snapshots

* remove unsued import

* add test for `kv --help` snapshot

* update all snapshots
  • Loading branch information
RamIdeas authored Jun 6, 2024
1 parent e144f63 commit 35b1a2f
Show file tree
Hide file tree
Showing 6 changed files with 284 additions and 147 deletions.
7 changes: 7 additions & 0 deletions .changeset/eleven-cows-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"wrangler": minor
---

feature: rename `wrangler kv:...` commands to `wrangler kv ...`

The old commands are now deprecated (but still functional) and will be removed in a future release. The new commands are now more consistent with the rest of the wrangler CLI commands.
98 changes: 47 additions & 51 deletions packages/wrangler/src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ describe("wrangler", () => {
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: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
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
Expand Down Expand Up @@ -97,9 +95,7 @@ describe("wrangler", () => {
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: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
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
Expand Down Expand Up @@ -175,70 +171,70 @@ describe("wrangler", () => {
`);
});

it("no subcommand 'kv:namespace' should display a list of available subcommands", async () => {
await runWrangler("kv:namespace");
it("no subcommand 'kv namespace' should display a list of available subcommands", async () => {
await runWrangler("kv namespace");
await endEventLoop();
expect(std.out).toMatchInlineSnapshot(`
"wrangler kv:namespace
"wrangler kv namespace
🗂️ Interact with your Workers KV Namespaces
🗂️ Interact with your Workers KV Namespaces
Commands:
wrangler kv:namespace create <namespace> 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.
Commands:
wrangler kv namespace create <namespace> 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]"
`);
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:key' should display a list of available subcommands", async () => {
await runWrangler("kv:key");
it("no subcommand 'kv key' should display a list of available subcommands", async () => {
await runWrangler("kv key");
await endEventLoop();
expect(std.out).toMatchInlineSnapshot(`
"wrangler kv:key
"wrangler kv key
🔑 Individually manage Workers KV key-value pairs
🔑 Individually manage Workers KV key-value pairs
Commands:
wrangler kv:key put <key> [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 <key> Reads a single value by key from the given namespace.
wrangler kv:key delete <key> Removes a single key value pair from the given namespace.
Commands:
wrangler kv key put <key> [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 <key> Reads a single value by key from the given namespace.
wrangler kv key delete <key> 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]"
`);
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:bulk' should display a list of available subcommands", async () => {
await runWrangler("kv:bulk");
it("no subcommand 'kv bulk' should display a list of available subcommands", async () => {
await runWrangler("kv bulk");
await endEventLoop();
expect(std.out).toMatchInlineSnapshot(`
"wrangler kv:bulk
"wrangler kv bulk
💪 Interact with multiple Workers KV key-value pairs at once
💪 Interact with multiple Workers KV key-value pairs at once
Commands:
wrangler kv:bulk put <filename> Upload multiple key-value pairs to a namespace
wrangler kv:bulk delete <filename> Delete multiple key-value pairs from a namespace
Commands:
wrangler kv bulk put <filename> Upload multiple key-value pairs to a namespace
wrangler kv bulk delete <filename> 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]"
`);
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 'r2' should display a list of available subcommands", async () => {
Expand Down
Loading

0 comments on commit 35b1a2f

Please sign in to comment.