Skip to content

Commit 8278db5

Browse files
authored
Add containers subcommand (#8562)
1 parent 0fe3260 commit 8278db5

File tree

5 files changed

+48
-3
lines changed

5 files changed

+48
-3
lines changed

.changeset/orange-gifts-cover.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"wrangler": patch
3+
---
4+
5+
Add initial containers subcommand to wrangler.

packages/wrangler/src/__tests__/cloudchamber/images.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ describe("cloudchamber image list", () => {
181181
expect(std.out).toMatchInlineSnapshot(`
182182
"wrangler cloudchamber images list
183183
184-
perform operations on images in your cloudchamber registry
184+
perform operations on images in your Cloudflare managed registry
185185
186186
GLOBAL FLAGS
187187
-c, --config Path to Wrangler configuration file [string]

packages/wrangler/src/cloudchamber/images/list.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const imagesCommand = (yargs: CommonYargsArgvJSON) => {
2525
return yargs
2626
.command(
2727
"list",
28-
"perform operations on images in your cloudchamber registry",
28+
"perform operations on images in your Cloudflare managed registry",
2929
(args) => listImagesYargs(args),
3030
(args) =>
3131
handleFailure(async (_args: CommonYargsArgvSanitizedJSON, config) => {
@@ -34,7 +34,7 @@ export const imagesCommand = (yargs: CommonYargsArgvJSON) => {
3434
)
3535
.command(
3636
"delete [image]",
37-
"remove an image from your cloudchamber registry",
37+
"remove an image from your Cloudflare managed registry",
3838
(args) => deleteImageYargs(args),
3939
(args) =>
4040
handleFailure(async (_args: CommonYargsArgvSanitizedJSON, config) => {
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import {
2+
buildCommand,
3+
buildYargs,
4+
pushCommand,
5+
pushYargs,
6+
} from "../cloudchamber/build";
7+
import { handleFailure } from "../cloudchamber/common";
8+
import { imagesCommand } from "../cloudchamber/images/list";
9+
import type { CommonYargsArgvJSON, CommonYargsOptions } from "../yargs-types";
10+
import type { CommandModule } from "yargs";
11+
12+
export const containers = (
13+
yargs: CommonYargsArgvJSON,
14+
subHelp: CommandModule<CommonYargsOptions, CommonYargsOptions>
15+
) => {
16+
return yargs
17+
.command(
18+
"build [PATH]",
19+
"build a dockerfile",
20+
(args) => buildYargs(args),
21+
(args) => handleFailure(buildCommand)(args)
22+
)
23+
.command(
24+
"push [TAG]",
25+
"push a tagged image to a Cloudflare managed registry, which is automatically integrated with your account",
26+
(args) => pushYargs(args),
27+
(args) => handleFailure(pushCommand)(args)
28+
)
29+
.command(
30+
"images",
31+
"perform operations on images in your Cloudflare managed registry",
32+
(args) => imagesCommand(args).command(subHelp)
33+
);
34+
};

packages/wrangler/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
import { checkNamespace, checkStartupCommand } from "./check/commands";
1717
import { cloudchamber } from "./cloudchamber";
1818
import { experimental_readRawConfig, loadDotEnv } from "./config";
19+
import { containers } from "./containers";
1920
import { demandSingleValue } from "./core";
2021
import { CommandRegistry } from "./core/CommandRegistry";
2122
import { createRegisterYargsCommand } from "./core/register-yargs-command";
@@ -782,6 +783,11 @@ export function createCLIParser(argv: string[]) {
782783
return cloudchamber(asJson(cloudchamberArgs.command(subHelp)), subHelp);
783784
});
784785

786+
// containers
787+
wrangler.command("containers", false, (containersArgs) => {
788+
return containers(asJson(containersArgs.command(subHelp)), subHelp);
789+
});
790+
785791
// [PRIVATE BETA] pubsub
786792
wrangler.command(
787793
"pubsub",

0 commit comments

Comments
 (0)