Skip to content

Commit dbd1d92

Browse files
committed
fix(usage): render valueHint for positional args
1 parent 0e73aad commit dbd1d92

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

playground/commands/build.ts

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export default defineCommand({
3535
type: "positional",
3636
required: false,
3737
description: "path to output directory",
38+
default: ".output",
3839
},
3940
},
4041
run({ args }) {

playground/commands/deploy.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ export default defineCommand({
4747
type: "boolean",
4848
description: "Dry run the deployment process",
4949
},
50-
outputDir: {
50+
provider: {
5151
type: "positional",
52-
description: "Path to the build output directory",
53-
default: ".output",
52+
description: "Deployment provider",
53+
valueHint: "foo|bar|baz|qux",
5454
},
5555
},
5656
run({ args }) {

src/usage.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,12 @@ export async function renderUsage<T extends ArgsDef = ArgsDef>(
3737
const name = arg.name.toUpperCase();
3838
const isRequired = arg.required !== false && arg.default === undefined;
3939
// (isRequired ? " (required)" : " (optional)"
40-
const usageHint = arg.default ? `="${arg.default}"` : "";
41-
posLines.push(["`" + name + usageHint + "`", arg.description || ""]);
40+
const defaultHint = arg.default ? `="${arg.default}"` : "";
41+
posLines.push([
42+
"`" + name + defaultHint + "`",
43+
arg.description || "",
44+
arg.valueHint ? `<${arg.valueHint}>` : "",
45+
]);
4246
usageLine.push(isRequired ? `<${name}>` : `[${name}]`);
4347
} else {
4448
const isRequired = arg.required === true && arg.default === undefined;

0 commit comments

Comments
 (0)