@@ -4,20 +4,15 @@ import { HeaderAnchor } from "../_components/HeaderAnchor.tsx";
4
4
import CLI_REFERENCE from "../runtime/reference/cli/_commands_reference.json" with {
5
5
type : "json" ,
6
6
} ;
7
- import { VNode } from "npm:preact" ;
8
7
9
8
type ArgType = {
10
9
name : string ;
11
- help : string ;
12
- short :
13
- | string
14
- | number
15
- | bigint
16
- | boolean
17
- | object
18
- | VNode < any >
19
- | null
20
- | undefined ;
10
+ short : string | null ;
11
+ long : string ;
12
+ required : boolean ;
13
+ help : string | null ;
14
+ help_heading : string | null ;
15
+ usage : string ;
21
16
} ;
22
17
23
18
const ANSI_RE = ansiRegex ( ) ;
@@ -45,7 +40,7 @@ function flagsToInlineCode(text: string): string {
45
40
export default function renderCommand (
46
41
commandName : string ,
47
42
helpers : Lume . Helpers ,
48
- ) : { rendered : any ; toc : TableOfContentsItem_ [ ] } {
43
+ ) : { rendered : JSX . Element ; toc : TableOfContentsItem_ [ ] } {
49
44
const command = CLI_REFERENCE . subcommands . find ( ( command ) =>
50
45
command . name === commandName
51
46
) ! ;
@@ -144,7 +139,7 @@ export default function renderCommand(
144
139
const id = heading . toLowerCase ( ) . replace ( / \s / g, "-" ) ;
145
140
146
141
const renderedFlags = flags . toSorted ( ( a : ArgType , b : ArgType ) =>
147
- a . name . localeCompare ( b . name )
142
+ a . long . localeCompare ( b . long )
148
143
) . map ( ( flag : ArgType ) => renderOption ( id , flag , helpers ) ) ;
149
144
150
145
toc . push ( {
@@ -172,7 +167,7 @@ export default function renderCommand(
172
167
}
173
168
174
169
function renderOption ( group : string , arg : ArgType , helpers : Lume . Helpers ) {
175
- const id = `${ group } -${ arg . name } ` ;
170
+ const id = `${ group } -${ arg . long } ` ;
176
171
177
172
let docsLink = null ;
178
173
// Add null check for arg.help
@@ -195,8 +190,8 @@ function renderOption(group: string, arg: ArgType, helpers: Lume.Helpers) {
195
190
< h3 id = { id } >
196
191
< code >
197
192
{ docsLink
198
- ? < a href = { docsLink } > { "--" + arg . name } </ a >
199
- : ( "--" + arg . name ) }
193
+ ? < a href = { docsLink } > { "--" + arg . long } </ a >
194
+ : ( "--" + arg . long ) }
200
195
</ code > { " " }
201
196
< HeaderAnchor id = { id } />
202
197
</ h3 >
0 commit comments