Skip to content

Commit 664f8bb

Browse files
authored
Fix handling of z- switches. (#991)
* Fix handling of z- switches. This was discovered in smoke testing of the artifacts feature. Artifacts was unable to download anything because it passes `--z-machine-readable-progress` which failed with: ``` PS C:\Dev\vcpkg-tool> C:\Users\bion\.vcpkg\vcpkg.exe x-download c:\Users\bion\.vcpkg\downloads\vcpkg.ce.default-registry.zip --z-machine-readable-progress --skip-sha512 --url=https://aka.ms/vcpkg-ce-default error: unexpected switch: --z-machine-readable-progress example: vcpkg x-download <filepath> [--sha512=]<sha512> [--url=https://...]... example: vcpkg x-download <filepath> --skip-sha512 [--url=https://...]...Options: --x-asset-sources=... Add sources for asset caching. See 'vcpkg help assetcaching'. --binarysource=... Add sources for binary caching. See 'vcpkg help binarycaching'. --x-buildtrees-root=... (Experimental) Specify the buildtrees root directory. --downloads-root=... Specify the downloads root directory. (default: VCPKG_DOWNLOADS) --header=... Additional header to use when fetching from URLs --host-triplet=... Specify the host architecture triplet. See 'vcpkg help triplet'. (default: 'VCPKG_DEFAULT_HOST_TRIPLET') --x-install-root=... (Experimental) Specify the install root directory. --overlay-ports=... Specify directories to be used when searching for ports. (also: 'VCPKG_OVERLAY_PORTS') --overlay-triplets=... Specifiy directories containing triplets files. (also: 'VCPKG_OVERLAY_TRIPLETS') --x-packages-root=... (Experimental) Specify the packages root directory. --sha512=... The hash of the file to be downloaded --skip-sha512 Do not check the SHA512 of the downloaded file --store Indicates the file should be stored instead of fetched --triplet=... Specify the target architecture triplet. See 'vcpkg help triplet'. (default: 'VCPKG_DEFAULT_TRIPLET') --url=... URL to download and store if missing from cache --vcpkg-root=... Specify the vcpkg root directory. (default: 'VCPKG_ROOT') PS C:\Dev\vcpkg-tool> ``` * Also add a new line before the options table.
1 parent 84b236b commit 664f8bb

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

CMakeSettings.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
]
9696
},
9797
{
98-
"name": "x64-Debug-Official-2023-03-14",
98+
"name": "x64-Debug-Official-2023-03-28",
9999
"generator": "Ninja",
100100
"configurationType": "Debug",
101101
"inheritEnvironments": [ "msvc_x64_x64" ],
@@ -112,17 +112,17 @@
112112
},
113113
{
114114
"name": "VCPKG_BASE_VERSION",
115-
"value": "2023-03-14",
115+
"value": "2023-03-28",
116116
"type": "STRING"
117117
},
118118
{
119119
"name": "VCPKG_STANDALONE_BUNDLE_SHA",
120-
"value": "32024d3d703aaa5961e8072ab883537a858885c501223530285926f919bad67003d40ba35686eb9d24673c4b030bb289a82d515c7bdf9931e9249d873b2b2abd",
120+
"value": "bdf19a9e602f237d3906321a13e883f72e8804e0bbbd4369b6fca3acdd98238371445c8cab2e7a155cf56db43a2f1e30060c71eaf4e3cb55d892d100a312ada5",
121121
"type": "STRING"
122122
},
123123
{
124124
"name": "VCPKG_CE_SHA",
125-
"value": "fb2c2f568b563a88d2ebf2b29ced491e8109134529c477629e5e1dde89f52bf8a60d9b5ce8285f260cc94b7c100704128d3724bbda523edb57233dbda5a2c02a",
125+
"value": "ffae1cb2fee518aba585a45f5e25c4eedf6218126821ae75808b9575b0c9d9b096ddb28475979a9c1a5ce217d920a91e1b510433a9f5a0ab5c4a44f6ff82a210",
126126
"type": "STRING"
127127
},
128128
{

src/vcpkg/base/cmd-parser.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1007,6 +1007,7 @@ namespace vcpkg
10071007
msg::write_unlocalized_text_to_stdout(Color::error, error.append_raw("\n"));
10081008
}
10091009

1010+
example.append_raw('\n');
10101011
append_options_table(example);
10111012
msg::println(Color::none, example);
10121013
Checks::exit_with_code(VCPKG_LINE_INFO, 1);

src/vcpkg/vcpkgcmdarguments.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ namespace
7777
name.erase(0, 2);
7878
tag = StabilityTag::Experimental;
7979
}
80+
else if (Strings::starts_with(name, "z-"))
81+
{
82+
name.erase(0, 2);
83+
tag = StabilityTag::ImplementationDetail;
84+
}
8085

8186
if (switch_.helpmsg)
8287
{
@@ -105,6 +110,11 @@ namespace
105110
name.erase(0, 2);
106111
tag = StabilityTag::Experimental;
107112
}
113+
else if (Strings::starts_with(name, "z-"))
114+
{
115+
name.erase(0, 2);
116+
tag = StabilityTag::ImplementationDetail;
117+
}
108118

109119
if (option.helpmsg)
110120
{
@@ -132,6 +142,11 @@ namespace
132142
name.erase(0, 2);
133143
tag = StabilityTag::Experimental;
134144
}
145+
else if (Strings::starts_with(name, "z-"))
146+
{
147+
name.erase(0, 2);
148+
tag = StabilityTag::ImplementationDetail;
149+
}
135150

136151
std::vector<std::string> maybe_parse_result;
137152
if (option.helpmsg)

0 commit comments

Comments
 (0)