Skip to content

Commit 1626b0f

Browse files
authored
Add several argument flags to split-cmdline (#77280)
* Add missing arg-flags to split-cmdline * Add parameter arguments scraped from --help menus to split-cmdline * Break apart line in comment to fix lint error
1 parent b8db9d4 commit 1626b0f

File tree

1 file changed

+236
-13
lines changed

1 file changed

+236
-13
lines changed

utils/dev-scripts/split-cmdline

Lines changed: 236 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,43 +76,266 @@ 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-]+) <' \
92+
# | sed 's/ *$//' | tr ' ' '\n' \
93+
# | sort | uniq \
94+
# | sed -E 's/(.*)/"\1",/'
95+
"--analyzer-output",
96+
"--build-system",
97+
"--cache-path",
98+
"--config-path",
99+
"--configuration",
100+
"--default-registry-url",
101+
"--experimental-traits",
102+
"--explicit-target-dependency-import-check",
103+
"--filter",
104+
"--jobs",
105+
"--manifest-cache",
106+
"--netrc-file",
107+
"--num-workers",
108+
"--package-path",
109+
"--pkg-config-path",
110+
"--product",
111+
"--resolver-fingerprint-checking",
112+
"--resolver-signing-entity-checking",
113+
"--sanitize",
114+
"--scratch-path",
79115
"--sdk",
116+
"--security-path",
117+
"--skip",
118+
"--specifier",
119+
"--swift-sdk",
120+
"--swift-sdks-path",
121+
"--target",
80122
"--toolchain",
123+
"--triple",
124+
"--xunit-output",
125+
"-B",
81126
"-D",
82127
"-F",
128+
"-Fsystem",
129+
"-G",
83130
"-I",
84131
"-L",
132+
"-MF",
133+
"-MJ",
134+
"-MQ",
135+
"-MT",
136+
"-T",
137+
"-U",
138+
"-Xanalyzer",
139+
"-Xarch_device",
140+
"-Xarch_host",
141+
"-Xassembler",
85142
"-Xcc",
86143
"-Xclang",
87-
"-Xfrontend",
144+
"-Xcuda-fatbinary",
145+
"-Xcuda-ptxas",
146+
"-Xcxx",
88147
"-Xlinker",
89-
"-Xllvm",
90-
"-add_ast_path",
91-
"-arch",
92-
"-emit-ir",
93-
"-emit-sil",
148+
"-Xopenmp-target",
149+
"-Xpreprocessor",
150+
"-Xswiftc",
151+
"-access-notes-path",
152+
"-allowable-client",
153+
"-api-diff-data-dir",
154+
"-api-diff-data-file",
155+
"-arcmt-migrate-report-output",
156+
"-assert-config",
157+
"-autolink-library",
158+
"-b",
159+
"-backup-module-interface-path",
160+
"-batch-scan-input-file",
161+
"-blocklist-file",
162+
"-build-id",
163+
"-c",
164+
"-cache-replay-prefix-map",
165+
"-cas-path",
166+
"-cas-plugin-option",
167+
"-cas-plugin-path",
168+
"-cc1-args",
169+
"-clang-build-session-file",
170+
"-clang-scanner-module-cache-path",
171+
"-clang-target",
172+
"-compare-to-baseline-path",
173+
"-const-gather-protocols-file",
174+
"-coverage-prefix-map",
175+
"-cxx-isystem",
176+
"-darwin-target-variant",
177+
"-darwin-target-variant-triple",
178+
"-debug-info-format",
179+
"-debug-prefix-map",
180+
"-define-availability",
181+
"-dependency-dot",
182+
"-dependency-file",
183+
"-dependency-scan-cache-path",
184+
"-diagnostic-documentation-path",
185+
"-diagnostic-style",
186+
"-digester-breakage-allowlist-path",
187+
"-digester-mode",
188+
"-dsym-dir",
189+
"-dump-api-path",
190+
"-dump-migration-states-dir",
191+
"-dump-scope-maps",
192+
"-dumpdir",
193+
"-e",
194+
"-embed-tbd-for-module",
195+
"-emit-abi-descriptor-path",
196+
"-emit-api-descriptor-path",
197+
"-emit-clang-header-path",
198+
"-emit-const-values-path",
199+
"-emit-dependencies-path",
200+
"-emit-digester-baseline-path",
201+
"-emit-fixits-path",
202+
"-emit-loaded-module-trace-path",
203+
"-emit-migrated-file-path",
204+
"-emit-module-dependencies-path",
205+
"-emit-module-doc-path",
206+
"-emit-module-interface-path",
207+
"-emit-module-path",
208+
"-emit-module-semantic-info-path",
209+
"-emit-module-serialize-diagnostics-path",
210+
"-emit-module-source-info-path",
211+
"-emit-module-summary-path",
212+
"-emit-objc-header-path",
213+
"-emit-reference-dependencies-path",
214+
"-emit-remap-file-path",
215+
"-emit-tbd-path",
216+
"-enable-experimental-feature",
217+
"-enable-upcoming-feature",
218+
"-explain-module-dependency",
219+
"-explain-module-dependency-detailed",
220+
"-explicit-swift-module-map-file",
221+
"-export-as",
222+
"-external-plugin-path",
223+
"-fdepscan-share-identifier",
224+
"-file-compilation-dir",
225+
"-file-prefix-map",
94226
"-filelist",
95-
"-fileno",
227+
"-fmodules-user-build-path",
96228
"-framework",
97-
"-import-objc-header",
229+
"-group-info-path",
230+
"-iapinotes-modules",
231+
"-iapinotes-path",
232+
"-idirafter",
233+
"-iframework",
234+
"-iframeworkwithsysroot",
235+
"-imacros",
236+
"-in-process-plugin-server-path",
237+
"-include",
238+
"-include-pch",
239+
"-index-file-path",
240+
"-index-store-path",
241+
"-index-unit-output-path",
242+
"-index-unit-output-path-filelist",
243+
"-iprefix",
98244
"-iquote",
99245
"-isysroot",
100-
"-macosx_version_min",
246+
"-isystem",
247+
"-isystem-after",
248+
"-ivfsoverlay",
249+
"-ivfsstatcache",
250+
"-iwithprefix",
251+
"-iwithprefixbefore",
252+
"-iwithsysroot",
253+
"-j",
254+
"-l",
255+
"-libc",
256+
"-load-plugin-executable",
257+
"-load-plugin-library",
258+
"-locale",
259+
"-localization-path",
260+
"-lto-library",
261+
"-meabi",
262+
"-mllvm",
263+
"-mmlir",
264+
"-module-abi-name",
265+
"-module-alias",
266+
"-module-cache-path",
267+
"-module-can-import",
268+
"-module-can-import-version",
269+
"-module-dependency-dir",
101270
"-module-link-name",
102271
"-module-name",
272+
"-mthread-model",
103273
"-num-threads",
104274
"-o",
105275
"-output-file-map",
276+
"-output-filelist",
277+
"-package-name",
278+
"-placeholder-dependency-module-map-file",
279+
"-plugin-path",
280+
"-prebuilt-module-cache-path",
106281
"-primary-file",
107-
"-resource-dir",
108-
"-rpath",
282+
"-primary-filelist",
283+
"-project-name",
284+
"-require-explicit-availability-target",
285+
"-runtime-compatibility-version",
286+
"-s",
287+
"-save-optimization-record-passes",
288+
"-save-optimization-record-path",
289+
"-scanner-prefix-map",
290+
"-scanner-prefix-map-sdk",
291+
"-scanner-prefix-map-toolchain",
109292
"-sdk",
293+
"-serialize-breaking-changes-path",
294+
"-serialize-diagnostics",
295+
"-serialize-diagnostics-path",
296+
"-serialized-path-obfuscate",
297+
"-supplementary-output-file-map",
298+
"-swift-isa-ptrauth-mode",
299+
"-swift-module-cross-import",
300+
"-swift-ptrauth-mode",
110301
"-swift-version",
111-
"-syslibroot",
302+
"-sysroot",
112303
"-target",
113-
"-target-sdk-version",
304+
"-target-cpu",
305+
"-target-min-inlining-version",
306+
"-target-variant",
307+
"-tbd-compatibility-version",
308+
"-tbd-current-version",
309+
"-tbd-install_name",
310+
"-tools-directory",
311+
"-user-module-version",
312+
"-verify-additional-file",
313+
"-verify-additional-prefix",
314+
"-verify-generic-signatures",
315+
"-vfsoverlay",
316+
"-visualc-tools-root",
317+
"-visualc-tools-version",
318+
"-windows-sdk-root",
319+
"-windows-sdk-version",
114320
"-working-directory",
115321
"-x",
322+
"-z",
323+
] + [
324+
# This list contains options that do not appear in --help menus:
325+
"-Xfrontend",
326+
"-Xllvm",
327+
"-add_ast_path",
328+
"-arch",
329+
"-emit-ir",
330+
"-emit-sil",
331+
"-fileno",
332+
"-import-objc-header",
333+
"-macosx_version_min",
334+
"-resource-dir",
335+
"-rpath",
336+
"-syslibroot",
337+
"-target-sdk-version",
338+
"-target-sdk-name",
116339
]
117340
# Heuristic: options ending in -path expect an argument
118341
if arg.startswith("-") and arg.endswith("-path"):

0 commit comments

Comments
 (0)