aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2020-04-30 09:43:55 -0700
committerGitHub <noreply@github.com>2020-04-30 09:43:55 -0700
commit3ae3bd34453d9fa453b26f8938cb85f07f9b89c8 (patch)
tree357a2afd81cffcde07f03d6c1172b72a4c25cdd7 /toolsrc/src
parente1381361d586c15877cfc04700fb520b7fc28823 (diff)
downloadvcpkg-3ae3bd34453d9fa453b26f8938cb85f07f9b89c8.tar.gz
vcpkg-3ae3bd34453d9fa453b26f8938cb85f07f9b89c8.zip
[vcpkg] Warn on unmatched removal with reasonable alternative (#11083)
Diffstat (limited to 'toolsrc/src')
-rw-r--r--toolsrc/src/vcpkg/remove.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/toolsrc/src/vcpkg/remove.cpp b/toolsrc/src/vcpkg/remove.cpp
index bb25cd21d..5d033cd31 100644
--- a/toolsrc/src/vcpkg/remove.cpp
+++ b/toolsrc/src/vcpkg/remove.cpp
@@ -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);