feat(cli): show yanked binary variants in listings
This commit is contained in:
1 parent
4e5bdab8cd
commit
349ec257f5
8 files changed
+44
-11
No files matched your search
+8
-4
@@ -1175,8 +1175,9 @@ int execute_binaries_command(std::string_view sub, const BinariesCmdOptions &opt
|
||||
}
|
||||
|
||||
Package::RegistryAuth auth{Void::Configuration::get_env_or(opts.token_env, "")};
|
||||
auto variants =
|
||||
Package::fetch_binary_variants(registry_url, *opts.name_arg, *opts.version_arg, auth);
|
||||
// Listing shows yanked variants (marked); fetch below only resolves non-yanked ones.
|
||||
auto variants = Package::fetch_binary_variants(registry_url, *opts.name_arg, *opts.version_arg,
|
||||
auth, sub == "list");
|
||||
if (!variants) {
|
||||
std::cerr << "vbs binaries: " << variants.error().message() << '\n';
|
||||
return 1;
|
||||
@@ -1185,8 +1186,11 @@ int execute_binaries_command(std::string_view sub, const BinariesCmdOptions &opt
|
||||
if (sub == "list") {
|
||||
for (const auto &variant : *variants) {
|
||||
std::cout << variant.variant_id << ' ' << variant.sha256 << ' ' << variant.size_bytes
|
||||
<< ' ' << ((variant.signature && variant.public_key) ? "signed" : "unsigned")
|
||||
<< '\n';
|
||||
<< ' ' << ((variant.signature && variant.public_key) ? "signed" : "unsigned");
|
||||
if (variant.yanked) {
|
||||
std::cout << " yanked";
|
||||
}
|
||||
std::cout << '\n';
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -450,7 +450,7 @@ publish_binary_variant(const BinaryPublishOptions &options) {
|
||||
|
||||
Void::Result::Result<std::vector<BinaryReleaseInfo>, Void::Result::Error>
|
||||
fetch_binary_variants(std::string_view registry_url, std::string_view package_name,
|
||||
std::string_view version, const RegistryAuth &auth) {
|
||||
std::string_view version, const RegistryAuth &auth, bool include_yanked) {
|
||||
auto parsed_url = parse_registry_url(registry_url);
|
||||
if (!parsed_url) {
|
||||
return std::unexpected{parsed_url.error()};
|
||||
@@ -519,8 +519,9 @@ fetch_binary_variants(std::string_view registry_url, std::string_view package_na
|
||||
if (const auto key = get_str(*bo, "public_key"); !key.empty()) {
|
||||
info.public_key = key;
|
||||
}
|
||||
// Yanked variants stay listed but must never be selected for materialization.
|
||||
if (!info.variant_id.empty() && !info.yanked) {
|
||||
// Yanked variants are hidden by default so they are never selected for
|
||||
// materialization; listing callers can opt in for inspection.
|
||||
if (!info.variant_id.empty() && (include_yanked || !info.yanked)) {
|
||||
variants.push_back(std::move(info));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user