зеркало из https://github.com/microsoft/vcpkg.git
[vcpkg] Warn on unmatched removal with reasonable alternative (#11083)
This commit is contained in:
Родитель
e1381361d5
Коммит
3ae3bd3445
|
@ -178,10 +178,8 @@ namespace vcpkg::Remove
|
|||
|
||||
if (purge == Purge::YES)
|
||||
{
|
||||
System::printf("Purging package %s...\n", display_name);
|
||||
Files::Filesystem& fs = paths.get_filesystem();
|
||||
fs.remove_all(paths.packages / action.spec.dir(), VCPKG_LINE_INFO);
|
||||
System::printf(System::Color::success, "Purging package %s... done\n", display_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -193,7 +191,7 @@ namespace vcpkg::Remove
|
|||
|
||||
static constexpr std::array<CommandSwitch, 5> SWITCHES = {{
|
||||
{OPTION_PURGE, "Remove the cached copy of the package (default)"},
|
||||
{OPTION_NO_PURGE, "Do not remove the cached copy of the package"},
|
||||
{OPTION_NO_PURGE, "Do not remove the cached copy of the package (deprecated)"},
|
||||
{OPTION_RECURSE, "Allow removal of packages not explicitly specified on the command line"},
|
||||
{OPTION_DRY_RUN, "Print the packages to be removed, but do not remove them"},
|
||||
{OPTION_OUTDATED, "Select all packages with versions that do not match the portfiles"},
|
||||
|
@ -294,6 +292,27 @@ namespace vcpkg::Remove
|
|||
}
|
||||
}
|
||||
|
||||
for (const auto& action : remove_plan)
|
||||
{
|
||||
if (action.plan_type == RemovePlanType::NOT_INSTALLED && action.request_type == RequestType::USER_REQUESTED)
|
||||
{
|
||||
// The user requested removing a package that was not installed. If the port is installed for another
|
||||
// triplet, warn the user that they may have meant that other package.
|
||||
for (const auto& package : status_db)
|
||||
{
|
||||
if (package->is_installed() && !package->package.is_feature() &&
|
||||
package->package.spec.name() == action.spec.name())
|
||||
{
|
||||
System::print2(
|
||||
System::Color::warning,
|
||||
"Another installed package matches the name of an unmatched request. Did you mean ",
|
||||
package->package.spec,
|
||||
"?\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dry_run)
|
||||
{
|
||||
Checks::exit_success(VCPKG_LINE_INFO);
|
||||
|
|
Загрузка…
Ссылка в новой задаче