aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/commands_remove.cpp
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-04-06 18:57:17 -0700
committerAlexander Karatarakis <alkarata@microsoft.com>2017-04-07 15:45:13 -0700
commit60b49cf4f7958ae934bebfa165815ea79e403359 (patch)
tree852952ab4ffdf518766c9603192a46ff786af4c4 /toolsrc/src/commands_remove.cpp
parent1ed61c4de820da8a33828b3a220742357d2c004d (diff)
downloadvcpkg-60b49cf4f7958ae934bebfa165815ea79e403359.tar.gz
vcpkg-60b49cf4f7958ae934bebfa165815ea79e403359.zip
Extract functions for output formatting
Diffstat (limited to 'toolsrc/src/commands_remove.cpp')
-rw-r--r--toolsrc/src/commands_remove.cpp22
1 files changed, 4 insertions, 18 deletions
diff --git a/toolsrc/src/commands_remove.cpp b/toolsrc/src/commands_remove.cpp
index 185bc4185..8bf2c767b 100644
--- a/toolsrc/src/commands_remove.cpp
+++ b/toolsrc/src/commands_remove.cpp
@@ -121,32 +121,18 @@ namespace vcpkg::Commands::Remove
}
}
+ auto print_lambda = [](const PackageSpecWithRemovePlan* p) { return to_output_string(p->plan.request_type, p->spec.to_string()); };
+
if (!not_installed.empty())
{
std::sort(not_installed.begin(), not_installed.end(), &PackageSpecWithRemovePlan::compare_by_name);
- System::println("The following packages are not installed, so not removed:\n%s",
- Strings::join("\n", not_installed, [](const PackageSpecWithRemovePlan* p)
- {
- return " " + p->spec.to_string();
- }));
+ System::println("The following packages are not installed, so not removed:\n%s", Strings::join("\n", not_installed, print_lambda));
}
if (!remove.empty())
{
std::sort(remove.begin(), remove.end(), &PackageSpecWithRemovePlan::compare_by_name);
- System::println("The following packages will be removed:\n%s",
- Strings::join("\n", remove, [](const PackageSpecWithRemovePlan* p)
- {
- switch (p->plan.request_type)
- {
- case RequestType::AUTO_SELECTED:
- return " * " + p->spec.to_string();
- case RequestType::USER_REQUESTED:
- return " " + p->spec.to_string();
- default:
- Checks::unreachable(VCPKG_LINE_INFO);
- }
- }));
+ System::println("The following packages will be removed:\n%s", Strings::join("\n", remove, print_lambda));
}
}