Skip to content

Commit 1ced7d0

Browse files
authored
fix the display of wrangler positional args (#26489)
1 parent aadeed3 commit 1ced7d0

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/components/WranglerArg.astro

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ const sanitizedDescription = description
2020
const required = definition.demandOption;
2121
const defaultValue = definition.default;
2222
const alias = definition.alias;
23-
const positional = definition.positionalArgs?.includes(key);
2423
25-
const name = positional ? `[${key.toUpperCase()}]` : `--${key}`;
24+
const name = definition.positional ? `[${key.toUpperCase()}]` : `--${key}`;
2625
2726
let typeText;
2827
if (Array.isArray(type)) {

src/components/WranglerCommand.astro

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ const { globalFlags } = commands;
2828
const positionals = definition.positionalArgs
2929
?.map((p) => `[${p.toUpperCase()}]`)
3030
.join(" ");
31+
32+
const positionalSet = new Set(definition.positionalArgs);
3133
---
3234

3335
<AnchorHeading depth={headingLevel} title={`\`${command}\``} />
@@ -45,7 +47,12 @@ const positionals = definition.positionalArgs
4547
Object.entries(definition.args)
4648
.filter(([_, value]) => !value.hidden)
4749
.map(([key, value]) => {
48-
return <WranglerArg key={key} definition={value} />;
50+
return (
51+
<WranglerArg
52+
key={key}
53+
definition={{ ...value, positional: positionalSet.has(key) }}
54+
/>
55+
);
4956
})
5057
}
5158
</ul>

0 commit comments

Comments
 (0)