Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions toolsrc/src/vcpkg/remove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand All @@ -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"},
Expand Down Expand Up @@ -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);
Expand Down