Skip to content

Commit

Permalink
Add extra context to json flag description
Browse files Browse the repository at this point in the history
  • Loading branch information
IRCody committed Sep 9, 2024
1 parent b7df331 commit 7386e8f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/wrangler/src/__tests__/cloudchamber/curl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe("cloudchamber curl", () => {
-v, --version Show version number [boolean]
OPTIONS
--json Return output as clean JSON [boolean] [default: false]
--json Output json. Use for consistent, machine readable output. [boolean] [default: false]
-H, --header Add headers in the form of --header <name>:<value> [array]
-D, --data Add a JSON body to the request [string]
-X, --method [string] [default: \\"GET\\"]
Expand Down
13 changes: 9 additions & 4 deletions packages/wrangler/src/cloudchamber/curl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import { ApiError } from "./client/core/ApiError";
import { request } from "./client/core/request";
import type { Config } from "../config";
import type {
CommonYargsOptionsJSON,
StrictYargsOptionsToInterfaceJSON,
CommonYargsOptions,
StrictYargsOptionsToInterface,
} from "../yargs-types";
import type yargs from "yargs";

export function yargsCurl(args: yargs.Argv<CommonYargsOptionsJSON>) {
export function yargsCurl(args: yargs.Argv<CommonYargsOptions>) {
return args
.positional("path", { type: "string", default: "/" })
.option("header", {
Expand Down Expand Up @@ -44,11 +44,16 @@ export function yargsCurl(args: yargs.Argv<CommonYargsOptionsJSON>) {
describe: "Equivalent of using --data-binary @- in curl",
type: "boolean",
alias: "stdin",
})
.option("json", {
describe: "Output json. Use for consistent, machine readable output.",
type: "boolean",
default: false,
});
}

export async function curlCommand(
args: StrictYargsOptionsToInterfaceJSON<typeof yargsCurl>,
args: StrictYargsOptionsToInterface<typeof yargsCurl>,
config: Config
) {
await requestFromCmd(args, config);
Expand Down

0 comments on commit 7386e8f

Please sign in to comment.