aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaria Tavlaki <mariataylaki@hotmail.com>2017-10-02 00:38:53 +0300
committerMaria Tavlaki <mariataylaki@hotmail.com>2017-10-02 01:24:19 +0300
commit016c53e231f353bdfa35f8e265b281e8d56031ed (patch)
tree1671199cb60ccf6bcad68738bdc00611c59cfb52
parent7c2239f980197096a13e8fb4b96297b08616eb78 (diff)
downloadvcpkg-016c53e231f353bdfa35f8e265b281e8d56031ed.tar.gz
vcpkg-016c53e231f353bdfa35f8e265b281e8d56031ed.zip
Autocomplete: remove
-rw-r--r--toolsrc/src/commands_autocomplete.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/toolsrc/src/commands_autocomplete.cpp b/toolsrc/src/commands_autocomplete.cpp
index 013cea320..3963f904b 100644
--- a/toolsrc/src/commands_autocomplete.cpp
+++ b/toolsrc/src/commands_autocomplete.cpp
@@ -5,6 +5,7 @@
#include "vcpkg_Commands.h"
#include "vcpkg_Maps.h"
#include "vcpkg_System.h"
+#include "vcpkglib.h"
namespace vcpkg::Commands::Autocomplete
{
@@ -25,6 +26,25 @@ namespace vcpkg::Commands::Autocomplete
}
return results;
}
+
+ std::vector<std::string> autocomplete_remove(std::vector<StatusParagraph*> installed_packages,
+ const std::string& start_with)
+ {
+ std::vector<std::string> results;
+ const auto& istartswith = Strings::case_insensitive_ascii_starts_with;
+
+ for (const auto& installed_package : installed_packages)
+ {
+ auto sp = installed_package->package.displayname();
+
+ if (istartswith(sp, start_with))
+ {
+ results.push_back(sp);
+ }
+ }
+ return results;
+ }
+
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
static const std::string EXAMPLE =
@@ -46,6 +66,13 @@ namespace vcpkg::Commands::Autocomplete
results = autocomplete_install(source_paragraphs, start_with);
}
+ else if (requested_command == "remove")
+ {
+ const StatusParagraphs status_db = database_load_check(paths);
+ std::vector<StatusParagraph*> installed_packages = get_installed_ports(status_db);
+ results = autocomplete_remove(installed_packages, start_with);
+ }
+
System::println(Strings::join(" ", results));
Checks::exit_success(VCPKG_LINE_INFO);
}