Skip to content

Commit 1d4f4fc

Browse files
committed
Add parameter arguments scraped from --help menus to split-cmdline
1 parent 7547713 commit 1d4f4fc

File tree

1 file changed

+226
-14
lines changed

1 file changed

+226
-14
lines changed

utils/dev-scripts/split-cmdline

Lines changed: 226 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -76,51 +76,263 @@ def main():
7676

7777
# A hard-coded list of options which expect a parameter
7878
is_arg_param = arg in [
79+
# This list is generated by scraping --help menus from running:
80+
#
81+
# $ ( \
82+
# swift --help; \
83+
# swift build --help; \
84+
# swift run --help; \
85+
# swift repl --help; \
86+
# swift test --help; \
87+
# swift package --help; \
88+
# swiftc --help; \
89+
# xcrun swift-frontend --help; \
90+
# clang --help; \
91+
# ) | rg -o -r '$3 $2' -- ' ((-[\w-]+),)? (-[\w-]+) <' | sed 's/ *$//' | tr ' ' '\n' |sort | uniq | sed -E 's/(.*)/"\1",/'
92+
"--analyzer-output",
93+
"--build-system",
94+
"--cache-path",
95+
"--config-path",
96+
"--configuration",
97+
"--default-registry-url",
98+
"--experimental-traits",
99+
"--explicit-target-dependency-import-check",
100+
"--filter",
101+
"--jobs",
102+
"--manifest-cache",
103+
"--netrc-file",
104+
"--num-workers",
105+
"--package-path",
106+
"--pkg-config-path",
107+
"--product",
108+
"--resolver-fingerprint-checking",
109+
"--resolver-signing-entity-checking",
110+
"--sanitize",
111+
"--scratch-path",
79112
"--sdk",
113+
"--security-path",
114+
"--skip",
115+
"--specifier",
116+
"--swift-sdk",
117+
"--swift-sdks-path",
118+
"--target",
80119
"--toolchain",
120+
"--triple",
121+
"--xunit-output",
122+
"-B",
81123
"-D",
82124
"-F",
125+
"-Fsystem",
126+
"-G",
83127
"-I",
84128
"-L",
129+
"-MF",
130+
"-MJ",
131+
"-MQ",
132+
"-MT",
133+
"-T",
134+
"-U",
135+
"-Xanalyzer",
136+
"-Xarch_device",
137+
"-Xarch_host",
138+
"-Xassembler",
85139
"-Xcc",
86140
"-Xclang",
141+
"-Xcuda-fatbinary",
142+
"-Xcuda-ptxas",
87143
"-Xcxx",
88-
"-Xfrontend",
89144
"-Xlinker",
90-
"-Xllvm",
145+
"-Xopenmp-target",
146+
"-Xpreprocessor",
91147
"-Xswiftc",
92-
"-add_ast_path",
93-
"-arch",
148+
"-access-notes-path",
149+
"-allowable-client",
150+
"-api-diff-data-dir",
151+
"-api-diff-data-file",
152+
"-arcmt-migrate-report-output",
153+
"-assert-config",
154+
"-autolink-library",
155+
"-b",
156+
"-backup-module-interface-path",
157+
"-batch-scan-input-file",
94158
"-blocklist-file",
159+
"-build-id",
160+
"-c",
161+
"-cache-replay-prefix-map",
162+
"-cas-path",
163+
"-cas-plugin-option",
164+
"-cas-plugin-path",
165+
"-cc1-args",
95166
"-clang-build-session-file",
96-
"-emit-ir",
97-
"-emit-sil",
167+
"-clang-scanner-module-cache-path",
168+
"-clang-target",
169+
"-compare-to-baseline-path",
170+
"-const-gather-protocols-file",
171+
"-coverage-prefix-map",
172+
"-cxx-isystem",
173+
"-darwin-target-variant",
174+
"-darwin-target-variant-triple",
175+
"-debug-info-format",
176+
"-debug-prefix-map",
177+
"-define-availability",
178+
"-dependency-dot",
179+
"-dependency-file",
180+
"-dependency-scan-cache-path",
181+
"-diagnostic-documentation-path",
182+
"-diagnostic-style",
183+
"-digester-breakage-allowlist-path",
184+
"-digester-mode",
185+
"-dsym-dir",
186+
"-dump-api-path",
187+
"-dump-migration-states-dir",
188+
"-dump-scope-maps",
189+
"-dumpdir",
190+
"-e",
191+
"-embed-tbd-for-module",
192+
"-emit-abi-descriptor-path",
193+
"-emit-api-descriptor-path",
194+
"-emit-clang-header-path",
195+
"-emit-const-values-path",
196+
"-emit-dependencies-path",
197+
"-emit-digester-baseline-path",
198+
"-emit-fixits-path",
199+
"-emit-loaded-module-trace-path",
200+
"-emit-migrated-file-path",
201+
"-emit-module-dependencies-path",
202+
"-emit-module-doc-path",
203+
"-emit-module-interface-path",
204+
"-emit-module-path",
205+
"-emit-module-semantic-info-path",
206+
"-emit-module-serialize-diagnostics-path",
207+
"-emit-module-source-info-path",
208+
"-emit-module-summary-path",
209+
"-emit-objc-header-path",
210+
"-emit-reference-dependencies-path",
211+
"-emit-remap-file-path",
212+
"-emit-tbd-path",
98213
"-enable-experimental-feature",
214+
"-enable-upcoming-feature",
215+
"-explain-module-dependency",
216+
"-explain-module-dependency-detailed",
217+
"-explicit-swift-module-map-file",
218+
"-export-as",
219+
"-external-plugin-path",
220+
"-fdepscan-share-identifier",
99221
"-file-compilation-dir",
222+
"-file-prefix-map",
100223
"-filelist",
101-
"-fileno",
224+
"-fmodules-user-build-path",
102225
"-framework",
103-
"-import-objc-header",
226+
"-group-info-path",
227+
"-iapinotes-modules",
228+
"-iapinotes-path",
229+
"-idirafter",
230+
"-iframework",
231+
"-iframeworkwithsysroot",
232+
"-imacros",
233+
"-in-process-plugin-server-path",
234+
"-include",
235+
"-include-pch",
236+
"-index-file-path",
237+
"-index-store-path",
238+
"-index-unit-output-path",
239+
"-index-unit-output-path-filelist",
240+
"-iprefix",
104241
"-iquote",
105242
"-isysroot",
243+
"-isystem",
244+
"-isystem-after",
106245
"-ivfsoverlay",
107-
"-macosx_version_min",
246+
"-ivfsstatcache",
247+
"-iwithprefix",
248+
"-iwithprefixbefore",
249+
"-iwithsysroot",
250+
"-j",
251+
"-l",
252+
"-libc",
253+
"-load-plugin-executable",
254+
"-load-plugin-library",
255+
"-locale",
256+
"-localization-path",
257+
"-lto-library",
258+
"-meabi",
259+
"-mllvm",
260+
"-mmlir",
261+
"-module-abi-name",
262+
"-module-alias",
263+
"-module-cache-path",
264+
"-module-can-import",
265+
"-module-can-import-version",
266+
"-module-dependency-dir",
108267
"-module-link-name",
109268
"-module-name",
269+
"-mthread-model",
110270
"-num-threads",
111271
"-o",
112272
"-output-file-map",
273+
"-output-filelist",
274+
"-package-name",
275+
"-placeholder-dependency-module-map-file",
276+
"-plugin-path",
277+
"-prebuilt-module-cache-path",
113278
"-primary-file",
114-
"-resource-dir",
115-
"-rpath",
279+
"-primary-filelist",
280+
"-project-name",
281+
"-require-explicit-availability-target",
282+
"-runtime-compatibility-version",
283+
"-s",
284+
"-save-optimization-record-passes",
285+
"-save-optimization-record-path",
286+
"-scanner-prefix-map",
287+
"-scanner-prefix-map-sdk",
288+
"-scanner-prefix-map-toolchain",
116289
"-sdk",
290+
"-serialize-breaking-changes-path",
291+
"-serialize-diagnostics",
292+
"-serialize-diagnostics-path",
293+
"-serialized-path-obfuscate",
294+
"-supplementary-output-file-map",
295+
"-swift-isa-ptrauth-mode",
296+
"-swift-module-cross-import",
297+
"-swift-ptrauth-mode",
117298
"-swift-version",
118-
"-syslibroot",
299+
"-sysroot",
119300
"-target",
120-
"-target-sdk-version",
121-
"-target-sdk-name",
301+
"-target-cpu",
302+
"-target-min-inlining-version",
303+
"-target-variant",
304+
"-tbd-compatibility-version",
305+
"-tbd-current-version",
306+
"-tbd-install_name",
307+
"-tools-directory",
308+
"-user-module-version",
309+
"-verify-additional-file",
310+
"-verify-additional-prefix",
311+
"-verify-generic-signatures",
312+
"-vfsoverlay",
313+
"-visualc-tools-root",
314+
"-visualc-tools-version",
315+
"-windows-sdk-root",
316+
"-windows-sdk-version",
122317
"-working-directory",
123318
"-x",
319+
"-z",
320+
] + [
321+
# This list contains options that do not appear in --help menus:
322+
"-Xfrontend",
323+
"-Xllvm",
324+
"-add_ast_path",
325+
"-arch",
326+
"-emit-ir",
327+
"-emit-sil",
328+
"-fileno",
329+
"-import-objc-header",
330+
"-macosx_version_min",
331+
"-resource-dir",
332+
"-rpath",
333+
"-syslibroot",
334+
"-target-sdk-version",
335+
"-target-sdk-name",
124336
]
125337
# Heuristic: options ending in -path expect an argument
126338
if arg.startswith("-") and arg.endswith("-path"):

0 commit comments

Comments
 (0)