aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/commands_remove.cpp
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-04-03 15:22:09 -0700
committerRobert Schumacher <roschuma@microsoft.com>2017-04-04 13:05:02 -0700
commitebf1fff6a76d62a1abe62245c21a0d4d23664f01 (patch)
treeb8233743aed9d205191dfe1901700b9fb8776cda /toolsrc/src/commands_remove.cpp
parent2826c04976f6c8796775ff2bf196f88a761868ae (diff)
downloadvcpkg-ebf1fff6a76d62a1abe62245c21a0d4d23664f01.tar.gz
vcpkg-ebf1fff6a76d62a1abe62245c21a0d4d23664f01.zip
[vcpkg-remove] Make purge the default for remove.
Added (currently undocumented) --no-purge as workaround if required.
Diffstat (limited to 'toolsrc/src/commands_remove.cpp')
-rw-r--r--toolsrc/src/commands_remove.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/toolsrc/src/commands_remove.cpp b/toolsrc/src/commands_remove.cpp
index 417689a15..3d89f6d90 100644
--- a/toolsrc/src/commands_remove.cpp
+++ b/toolsrc/src/commands_remove.cpp
@@ -13,11 +13,6 @@ namespace vcpkg::Commands::Remove
using Dependencies::request_type;
using Update::outdated_package;
- static const std::string OPTION_PURGE = "--purge";
- static const std::string OPTION_RECURSE = "--recurse";
- static const std::string OPTION_DRY_RUN = "--dry-run";
- static const std::string OPTION_OUTDATED = "--outdated";
-
static void delete_directory(const fs::path& directory)
{
std::error_code ec;
@@ -169,8 +164,13 @@ namespace vcpkg::Commands::Remove
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_triplet)
{
+ static const std::string OPTION_PURGE = "--purge";
+ static const std::string OPTION_NO_PURGE = "--no-purge";
+ static const std::string OPTION_RECURSE = "--recurse";
+ static const std::string OPTION_DRY_RUN = "--dry-run";
+ static const std::string OPTION_OUTDATED = "--outdated";
static const std::string example = Commands::Help::create_example_string("remove zlib zlib:x64-windows curl boost");
- const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({ OPTION_PURGE, OPTION_RECURSE, OPTION_DRY_RUN, OPTION_OUTDATED });
+ const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({ OPTION_PURGE, OPTION_NO_PURGE, OPTION_RECURSE, OPTION_DRY_RUN, OPTION_OUTDATED });
StatusParagraphs status_db = database_load_check(paths);
std::vector<package_spec> specs;
@@ -187,7 +187,14 @@ namespace vcpkg::Commands::Remove
Input::check_triplet(spec.target_triplet(), paths);
}
- const bool alsoRemoveFolderFromPackages = options.find(OPTION_PURGE) != options.cend();
+ const bool alsoRemoveFolderFromPackages = options.find(OPTION_NO_PURGE) == options.end();
+ if (options.find(OPTION_PURGE) != options.end() && !alsoRemoveFolderFromPackages)
+ {
+ // User specified --purge and --no-purge
+ System::println(System::color::error, "Error: cannot specify both --no-purge and --purge.");
+ System::print(example);
+ Checks::exit_fail(VCPKG_LINE_INFO);
+ }
const bool isRecursive = options.find(OPTION_RECURSE) != options.cend();
const bool dryRun = options.find(OPTION_DRY_RUN) != options.cend();