mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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
This commit is contained in:
@@ -76,43 +76,266 @@ def main():
|
||||
|
||||
# A hard-coded list of options which expect a parameter
|
||||
is_arg_param = arg in [
|
||||
# This list is generated by scraping --help menus from running:
|
||||
#
|
||||
# $ ( \
|
||||
# swift --help; \
|
||||
# swift build --help; \
|
||||
# swift run --help; \
|
||||
# swift repl --help; \
|
||||
# swift test --help; \
|
||||
# swift package --help; \
|
||||
# swiftc --help; \
|
||||
# xcrun swift-frontend --help; \
|
||||
# clang --help; \
|
||||
# ) | rg -o -r '$3 $2' -- ' ((-[\w-]+),)? (-[\w-]+) <' \
|
||||
# | sed 's/ *$//' | tr ' ' '\n' \
|
||||
# | sort | uniq \
|
||||
# | sed -E 's/(.*)/"\1",/'
|
||||
"--analyzer-output",
|
||||
"--build-system",
|
||||
"--cache-path",
|
||||
"--config-path",
|
||||
"--configuration",
|
||||
"--default-registry-url",
|
||||
"--experimental-traits",
|
||||
"--explicit-target-dependency-import-check",
|
||||
"--filter",
|
||||
"--jobs",
|
||||
"--manifest-cache",
|
||||
"--netrc-file",
|
||||
"--num-workers",
|
||||
"--package-path",
|
||||
"--pkg-config-path",
|
||||
"--product",
|
||||
"--resolver-fingerprint-checking",
|
||||
"--resolver-signing-entity-checking",
|
||||
"--sanitize",
|
||||
"--scratch-path",
|
||||
"--sdk",
|
||||
"--security-path",
|
||||
"--skip",
|
||||
"--specifier",
|
||||
"--swift-sdk",
|
||||
"--swift-sdks-path",
|
||||
"--target",
|
||||
"--toolchain",
|
||||
"--triple",
|
||||
"--xunit-output",
|
||||
"-B",
|
||||
"-D",
|
||||
"-F",
|
||||
"-Fsystem",
|
||||
"-G",
|
||||
"-I",
|
||||
"-L",
|
||||
"-MF",
|
||||
"-MJ",
|
||||
"-MQ",
|
||||
"-MT",
|
||||
"-T",
|
||||
"-U",
|
||||
"-Xanalyzer",
|
||||
"-Xarch_device",
|
||||
"-Xarch_host",
|
||||
"-Xassembler",
|
||||
"-Xcc",
|
||||
"-Xclang",
|
||||
"-Xfrontend",
|
||||
"-Xcuda-fatbinary",
|
||||
"-Xcuda-ptxas",
|
||||
"-Xcxx",
|
||||
"-Xlinker",
|
||||
"-Xopenmp-target",
|
||||
"-Xpreprocessor",
|
||||
"-Xswiftc",
|
||||
"-access-notes-path",
|
||||
"-allowable-client",
|
||||
"-api-diff-data-dir",
|
||||
"-api-diff-data-file",
|
||||
"-arcmt-migrate-report-output",
|
||||
"-assert-config",
|
||||
"-autolink-library",
|
||||
"-b",
|
||||
"-backup-module-interface-path",
|
||||
"-batch-scan-input-file",
|
||||
"-blocklist-file",
|
||||
"-build-id",
|
||||
"-c",
|
||||
"-cache-replay-prefix-map",
|
||||
"-cas-path",
|
||||
"-cas-plugin-option",
|
||||
"-cas-plugin-path",
|
||||
"-cc1-args",
|
||||
"-clang-build-session-file",
|
||||
"-clang-scanner-module-cache-path",
|
||||
"-clang-target",
|
||||
"-compare-to-baseline-path",
|
||||
"-const-gather-protocols-file",
|
||||
"-coverage-prefix-map",
|
||||
"-cxx-isystem",
|
||||
"-darwin-target-variant",
|
||||
"-darwin-target-variant-triple",
|
||||
"-debug-info-format",
|
||||
"-debug-prefix-map",
|
||||
"-define-availability",
|
||||
"-dependency-dot",
|
||||
"-dependency-file",
|
||||
"-dependency-scan-cache-path",
|
||||
"-diagnostic-documentation-path",
|
||||
"-diagnostic-style",
|
||||
"-digester-breakage-allowlist-path",
|
||||
"-digester-mode",
|
||||
"-dsym-dir",
|
||||
"-dump-api-path",
|
||||
"-dump-migration-states-dir",
|
||||
"-dump-scope-maps",
|
||||
"-dumpdir",
|
||||
"-e",
|
||||
"-embed-tbd-for-module",
|
||||
"-emit-abi-descriptor-path",
|
||||
"-emit-api-descriptor-path",
|
||||
"-emit-clang-header-path",
|
||||
"-emit-const-values-path",
|
||||
"-emit-dependencies-path",
|
||||
"-emit-digester-baseline-path",
|
||||
"-emit-fixits-path",
|
||||
"-emit-loaded-module-trace-path",
|
||||
"-emit-migrated-file-path",
|
||||
"-emit-module-dependencies-path",
|
||||
"-emit-module-doc-path",
|
||||
"-emit-module-interface-path",
|
||||
"-emit-module-path",
|
||||
"-emit-module-semantic-info-path",
|
||||
"-emit-module-serialize-diagnostics-path",
|
||||
"-emit-module-source-info-path",
|
||||
"-emit-module-summary-path",
|
||||
"-emit-objc-header-path",
|
||||
"-emit-reference-dependencies-path",
|
||||
"-emit-remap-file-path",
|
||||
"-emit-tbd-path",
|
||||
"-enable-experimental-feature",
|
||||
"-enable-upcoming-feature",
|
||||
"-explain-module-dependency",
|
||||
"-explain-module-dependency-detailed",
|
||||
"-explicit-swift-module-map-file",
|
||||
"-export-as",
|
||||
"-external-plugin-path",
|
||||
"-fdepscan-share-identifier",
|
||||
"-file-compilation-dir",
|
||||
"-file-prefix-map",
|
||||
"-filelist",
|
||||
"-fmodules-user-build-path",
|
||||
"-framework",
|
||||
"-group-info-path",
|
||||
"-iapinotes-modules",
|
||||
"-iapinotes-path",
|
||||
"-idirafter",
|
||||
"-iframework",
|
||||
"-iframeworkwithsysroot",
|
||||
"-imacros",
|
||||
"-in-process-plugin-server-path",
|
||||
"-include",
|
||||
"-include-pch",
|
||||
"-index-file-path",
|
||||
"-index-store-path",
|
||||
"-index-unit-output-path",
|
||||
"-index-unit-output-path-filelist",
|
||||
"-iprefix",
|
||||
"-iquote",
|
||||
"-isysroot",
|
||||
"-isystem",
|
||||
"-isystem-after",
|
||||
"-ivfsoverlay",
|
||||
"-ivfsstatcache",
|
||||
"-iwithprefix",
|
||||
"-iwithprefixbefore",
|
||||
"-iwithsysroot",
|
||||
"-j",
|
||||
"-l",
|
||||
"-libc",
|
||||
"-load-plugin-executable",
|
||||
"-load-plugin-library",
|
||||
"-locale",
|
||||
"-localization-path",
|
||||
"-lto-library",
|
||||
"-meabi",
|
||||
"-mllvm",
|
||||
"-mmlir",
|
||||
"-module-abi-name",
|
||||
"-module-alias",
|
||||
"-module-cache-path",
|
||||
"-module-can-import",
|
||||
"-module-can-import-version",
|
||||
"-module-dependency-dir",
|
||||
"-module-link-name",
|
||||
"-module-name",
|
||||
"-mthread-model",
|
||||
"-num-threads",
|
||||
"-o",
|
||||
"-output-file-map",
|
||||
"-output-filelist",
|
||||
"-package-name",
|
||||
"-placeholder-dependency-module-map-file",
|
||||
"-plugin-path",
|
||||
"-prebuilt-module-cache-path",
|
||||
"-primary-file",
|
||||
"-primary-filelist",
|
||||
"-project-name",
|
||||
"-require-explicit-availability-target",
|
||||
"-runtime-compatibility-version",
|
||||
"-s",
|
||||
"-save-optimization-record-passes",
|
||||
"-save-optimization-record-path",
|
||||
"-scanner-prefix-map",
|
||||
"-scanner-prefix-map-sdk",
|
||||
"-scanner-prefix-map-toolchain",
|
||||
"-sdk",
|
||||
"-serialize-breaking-changes-path",
|
||||
"-serialize-diagnostics",
|
||||
"-serialize-diagnostics-path",
|
||||
"-serialized-path-obfuscate",
|
||||
"-supplementary-output-file-map",
|
||||
"-swift-isa-ptrauth-mode",
|
||||
"-swift-module-cross-import",
|
||||
"-swift-ptrauth-mode",
|
||||
"-swift-version",
|
||||
"-sysroot",
|
||||
"-target",
|
||||
"-target-cpu",
|
||||
"-target-min-inlining-version",
|
||||
"-target-variant",
|
||||
"-tbd-compatibility-version",
|
||||
"-tbd-current-version",
|
||||
"-tbd-install_name",
|
||||
"-tools-directory",
|
||||
"-user-module-version",
|
||||
"-verify-additional-file",
|
||||
"-verify-additional-prefix",
|
||||
"-verify-generic-signatures",
|
||||
"-vfsoverlay",
|
||||
"-visualc-tools-root",
|
||||
"-visualc-tools-version",
|
||||
"-windows-sdk-root",
|
||||
"-windows-sdk-version",
|
||||
"-working-directory",
|
||||
"-x",
|
||||
"-z",
|
||||
] + [
|
||||
# This list contains options that do not appear in --help menus:
|
||||
"-Xfrontend",
|
||||
"-Xllvm",
|
||||
"-add_ast_path",
|
||||
"-arch",
|
||||
"-emit-ir",
|
||||
"-emit-sil",
|
||||
"-filelist",
|
||||
"-fileno",
|
||||
"-framework",
|
||||
"-import-objc-header",
|
||||
"-iquote",
|
||||
"-isysroot",
|
||||
"-macosx_version_min",
|
||||
"-module-link-name",
|
||||
"-module-name",
|
||||
"-num-threads",
|
||||
"-o",
|
||||
"-output-file-map",
|
||||
"-primary-file",
|
||||
"-resource-dir",
|
||||
"-rpath",
|
||||
"-sdk",
|
||||
"-swift-version",
|
||||
"-syslibroot",
|
||||
"-target",
|
||||
"-target-sdk-version",
|
||||
"-working-directory",
|
||||
"-x",
|
||||
"-target-sdk-name",
|
||||
]
|
||||
# Heuristic: options ending in -path expect an argument
|
||||
if arg.startswith("-") and arg.endswith("-path"):
|
||||
|
||||
Reference in New Issue
Block a user