Skip to content

Commit e5a768b

Browse files
authored
Categorize CLI options (#1086)
1 parent 628fab2 commit e5a768b

File tree

2 files changed

+156
-97
lines changed

2 files changed

+156
-97
lines changed

Diff for: cli/asc.json

+133-96
Original file line numberDiff line numberDiff line change
@@ -1,181 +1,218 @@
11
{
22
"version": {
3+
"category": "General",
34
"description": "Prints just the compiler's version and exits.",
45
"type": "b",
56
"alias": "v"
67
},
78
"help": {
9+
"category": "General",
810
"description": "Prints this message and exits.",
911
"type": "b",
1012
"alias": "h"
1113
},
14+
"noColors": {
15+
"category": "General",
16+
"description": "Disables terminal colors.",
17+
"type": "b",
18+
"default": false
19+
},
20+
1221
"optimize": {
22+
"category": "Optimization",
1323
"description": [
14-
"Optimizes the module. Also has the usual shorthands:",
24+
"Optimizes the module. Typical shorthands are:",
1525
"",
16-
" -O Uses defaults. Equivalent to -O3s",
17-
" -O0 Equivalent to --optimizeLevel 0",
18-
" -O1 Equivalent to --optimizeLevel 1",
19-
" -O2 Equivalent to --optimizeLevel 2",
20-
" -O3 Equivalent to --optimizeLevel 3",
21-
" -Oz Equivalent to -O but with --shrinkLevel 2",
22-
" -O3s Equivalent to -O3 with --shrinkLevel 1 etc.",
26+
" Default optimizations -O / -O3s",
27+
" Make a release build -O --noAssert",
28+
" Make a debug build --debug",
29+
" Optimize for speed -O3",
30+
" Optimize for size -O3z --converge",
2331
""
2432
],
2533
"type": "b",
2634
"alias": "O"
2735
},
2836
"optimizeLevel": {
37+
"category": "Optimization",
2938
"description": "How much to focus on optimizing code. [0-3]",
3039
"type": "i"
3140
},
3241
"shrinkLevel": {
42+
"category": "Optimization",
3343
"description": "How much to focus on shrinking code size. [0-2, s=1, z=2]",
3444
"type": "i"
3545
},
3646
"converge": {
47+
"category": "Optimization",
3748
"description": "Re-optimizes until no further improvements can be made.",
3849
"type": "b",
3950
"default": false
4051
},
41-
"validate": {
42-
"description": "Validates the module using Binaryen. Exits if invalid.",
52+
"noAssert": {
53+
"category": "Optimization",
54+
"description": "Replaces assertions with just their value without trapping.",
4355
"type": "b",
44-
"alias": "c",
4556
"default": false
4657
},
47-
"baseDir": {
48-
"description": "Specifies the base directory of input and output files.",
58+
"runtime": {
59+
"category": "Optimization",
60+
"description": [
61+
"Specifies the runtime variant to include in the program.",
62+
"",
63+
" full Default runtime based on TLSF and reference counting.",
64+
" half Same as 'full', but not exported to the host.",
65+
" stub Minimal stub implementation without free/GC support.",
66+
" none Same as 'stub', but not exported to the host.",
67+
""
68+
],
4969
"type": "s",
50-
"default": "."
70+
"default": "full"
5171
},
72+
5273
"outFile": {
74+
"category": "Output",
5375
"description": "Specifies the output file. File extension indicates format.",
5476
"type": "s",
5577
"alias": "o"
5678
},
5779
"binaryFile": {
80+
"category": "Output",
5881
"description": "Specifies the binary output file (.wasm).",
5982
"type": "s",
6083
"alias": "b"
6184
},
6285
"textFile": {
86+
"category": "Output",
6387
"description": "Specifies the text output file (.wat).",
6488
"type": "s",
6589
"alias": "t"
6690
},
6791
"asmjsFile": {
92+
"category": "Output",
6893
"description": "Specifies the asm.js output file (.js).",
6994
"type": "s",
7095
"alias": "a"
7196
},
7297
"idlFile": {
98+
"category": "Output",
7399
"description": "Specifies the WebIDL output file (.webidl).",
74100
"type": "s",
75101
"alias": "i"
76102
},
77103
"tsdFile": {
104+
"category": "Output",
78105
"description": "Specifies the TypeScript definition output file (.d.ts).",
79106
"type": "s",
80107
"alias": "d"
81108
},
109+
82110
"sourceMap": {
111+
"category": "Debugging",
83112
"description": [
84113
"Enables source map generation. Optionally takes the URL",
85114
"used to reference the source map from the binary file."
86115
],
87116
"type": "s"
88117
},
89-
"runtime": {
90-
"description": [
91-
"Specifies the runtime variant to include in the program.",
92-
"",
93-
" full Default runtime based on TLSF and reference counting.",
94-
" half Same as 'full', but not exported to the host.",
95-
" stub Minimal stub implementation without free/GC support.",
96-
" none Same as 'stub', but not exported to the host.",
97-
""
98-
],
99-
"type": "s",
100-
"default": "full"
101-
},
102-
"noUnsafe": {
103-
"description": [
104-
"Disallows the use of unsafe features in user code.",
105-
"Does not affect library files and external modules."
106-
],
107-
"type": "b",
108-
"default": false
109-
},
110118
"debug": {
119+
"category": "Debugging",
111120
"description": "Enables debug information in emitted binaries.",
112121
"type": "b",
113122
"default": false
114123
},
115-
"noAssert": {
116-
"description": "Replaces assertions with just their value without trapping.",
117-
"type": "b",
118-
"default": false
119-
},
120-
"noEmit": {
121-
"description": "Performs compilation as usual but does not emit code.",
122-
"type": "b",
123-
"default": false
124-
},
124+
125125
"importMemory": {
126+
"category": "Features",
126127
"description": "Imports the memory provided as 'env.memory'.",
127128
"type": "b",
128129
"default": false
129130
},
130131
"sharedMemory": {
132+
"category": "Features",
131133
"description": "Declare memory as shared by settings the max shared memory.",
132134
"type": "i",
133135
"default": 0
134136
},
135-
"memoryBase": {
136-
"description": "Sets the start offset of compiler-generated static memory.",
137-
"type": "i",
138-
"default": 0
139-
},
140137
"importTable": {
138+
"category": "Features",
141139
"description": "Imports the function table provided as 'env.table'.",
142140
"type": "b",
143141
"default": false
144142
},
145143
"exportTable": {
144+
"category": "Features",
146145
"description": "Exports the function table as 'table'.",
147146
"type": "b",
148147
"default": false
149148
},
150149
"explicitStart": {
151-
"description": "Exports an explicit start function to be called manually.",
150+
"category": "Features",
151+
"description": "Exports an explicit '_start' function to call.",
152152
"type": "b",
153153
"default": false
154154
},
155-
"lib": {
155+
"enable": {
156+
"category": "Features",
156157
"description": [
157-
"Adds one or multiple paths to custom library components and",
158-
"uses exports of all top-level files at this path as globals."
158+
"Enables WebAssembly features being disabled by default.",
159+
"",
160+
" sign-extension Sign-extension operations",
161+
" bulk-memory Bulk memory operations.",
162+
" simd SIMD types and operations.",
163+
" threads Threading and atomic operations.",
164+
" reference-types Reference types and operations.",
165+
""
159166
],
160-
"type": "s"
167+
"TODO_doesNothingYet": [
168+
" nontrapping-f2i Non-trapping float to integer ops.",
169+
" exception-handling Exception handling.",
170+
" tail-calls Tail call operations."
171+
],
172+
"type": "S"
161173
},
162-
"path": {
174+
"disable": {
175+
"category": "Features",
163176
"description": [
164-
"Adds one or multiple paths to package resolution, similar",
165-
"to node_modules. Prefers an 'ascMain' entry in a package's",
166-
"package.json and falls back to an inner 'assembly/' folder."
177+
"Disables WebAssembly features being enabled by default.",
178+
"",
179+
" mutable-globals Mutable global imports and exports.",
180+
""
167181
],
168182
"type": "S"
169183
},
170184
"use": {
185+
"category": "Features",
171186
"description": [
172187
"Aliases a global object under another name, e.g., to switch",
173-
"the default 'Math' implementation used: --use Math=JSMath"
188+
"the default 'Math' implementation used: --use Math=JSMath",
189+
"Can also be used to introduce an integer constant."
174190
],
175191
"type": "S",
176192
"alias": "u"
177193
},
194+
"memoryBase": {
195+
"category": "Features",
196+
"description": "Sets the start offset of compiler-generated static memory.",
197+
"type": "i",
198+
"default": 0
199+
},
200+
201+
"transform": {
202+
"category": "API",
203+
"description": "Specifies the path to a custom transform to 'require'.",
204+
"type": "S"
205+
},
206+
207+
"validate": {
208+
"category": "Binaryen",
209+
"description": "Validates the module using Binaryen. Exits if invalid.",
210+
"type": "b",
211+
"alias": "c",
212+
"default": false
213+
},
178214
"trapMode": {
215+
"category": "Binaryen",
179216
"description": [
180217
"Sets the trap mode to use.",
181218
"",
@@ -188,48 +225,57 @@
188225
"default": "allow"
189226
},
190227
"runPasses": {
228+
"category": "Binaryen",
191229
"description": [
192230
"Specifies additional Binaryen passes to run after other",
193231
"optimizations, if any. See: Binaryen/src/passes/pass.cpp"
194232
],
195233
"type": "s"
196234
},
197-
"enable": {
198-
"description": [
199-
"Enables WebAssembly features that are disabled by default.",
200-
"",
201-
" sign-extension Sign-extension operations",
202-
" bulk-memory Bulk memory operations.",
203-
" simd SIMD types and operations.",
204-
" threads Threading and atomic operations.",
205-
" reference-types Reference types and operations.",
206-
""
207-
],
208-
"TODO_doesNothingYet": [
209-
" nontrapping-f2i Non-trapping float to integer ops.",
210-
" exception-handling Exception handling.",
211-
" tail-calls Tail call operations."
212-
],
213-
"type": "S"
235+
236+
"baseDir": {
237+
"description": "Specifies the base directory of input and output files.",
238+
"type": "s",
239+
"default": "."
214240
},
215-
"disable": {
241+
"noUnsafe": {
216242
"description": [
217-
"Disables WebAssembly features that are enabled by default.",
218-
"",
219-
" mutable-globals Mutable global imports and exports.",
220-
""
243+
"Disallows the use of unsafe features in user code.",
244+
"Does not affect library files and external modules."
221245
],
222-
"type": "S"
246+
"type": "b",
247+
"default": false
223248
},
224-
"transform": {
225-
"description": "Specifies the path to a custom transform to 'require'.",
226-
"type": "S"
249+
"noEmit": {
250+
"description": "Performs compilation as usual but does not emit code.",
251+
"type": "b",
252+
"default": false
253+
},
254+
"measure": {
255+
"description": "Prints measuring information on I/O and compile times.",
256+
"type": "b",
257+
"default": false
227258
},
228259
"pedantic": {
229260
"description": "Make yourself sad for no good reason.",
230261
"type": "b",
231262
"default": false
232263
},
264+
"lib": {
265+
"description": [
266+
"Adds one or multiple paths to custom library components and",
267+
"uses exports of all top-level files at this path as globals."
268+
],
269+
"type": "s"
270+
},
271+
"path": {
272+
"description": [
273+
"Adds one or multiple paths to package resolution, similar",
274+
"to node_modules. Prefers an 'ascMain' entry in a package's",
275+
"package.json and falls back to an inner 'assembly/' folder."
276+
],
277+
"type": "S"
278+
},
233279
"traceResolution": {
234280
"description": "Enables tracing of package resolution.",
235281
"type": "b",
@@ -240,24 +286,15 @@
240286
"type": "b",
241287
"default": false
242288
},
243-
"measure": {
244-
"description": "Prints measuring information on I/O and compile times.",
245-
"type": "b",
246-
"default": false
247-
},
248289
"printrtti": {
249290
"description": "Prints the module's runtime type information to stderr.",
250291
"type": "b",
251292
"default": false
252293
},
253-
"noColors": {
254-
"description": "Disables terminal colors.",
255-
"type": "b",
256-
"default": false
257-
},
258294
" ...": {
259295
"description": "Specifies node.js options (CLI only). See: node --help"
260296
},
297+
261298
"-Os": { "value": { "optimize": true, "shrinkLevel": 1 } },
262299
"-Oz": { "value": { "optimize": true, "shrinkLevel": 2 } },
263300
"-O0": { "value": { "optimizeLevel": 0, "shrinkLevel": 0 } },

0 commit comments

Comments
 (0)