From 97b79e1f0c2c7e0e9ef2346c5b32b98e42a00155 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 21 Sep 2016 23:54:23 -0700 Subject: Place command_list() in a separate cpp file --- toolsrc/src/commands_list.cpp | 32 ++++++++++++++++++++++++++++++++ toolsrc/src/commands_other.cpp | 26 -------------------------- 2 files changed, 32 insertions(+), 26 deletions(-) create mode 100644 toolsrc/src/commands_list.cpp (limited to 'toolsrc/src') diff --git a/toolsrc/src/commands_list.cpp b/toolsrc/src/commands_list.cpp new file mode 100644 index 000000000..2969ea953 --- /dev/null +++ b/toolsrc/src/commands_list.cpp @@ -0,0 +1,32 @@ +#include "vcpkg_Commands.h" +#include "vcpkg.h" +#include "vcpkg_System.h" + +namespace vcpkg +{ + void list_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) + { + args.check_max_args(0); + + std::vector packages_output; + for (auto&& pgh : database_load_check(paths)) + { + if (pgh->state == install_state_t::not_installed && pgh->want == want_t::purge) + continue; + packages_output.push_back(Strings::format("%-27s %-16s %s", + pgh->package.displayname(), + pgh->package.version, + shorten_description(pgh->package.description))); + } + std::sort(packages_output.begin(), packages_output.end()); + for (auto&& package : packages_output) + { + System::println(package.c_str()); + } + if (packages_output.empty()) + { + System::println("No packages are installed. Did you mean `search`?"); + } + exit(EXIT_SUCCESS); + } +} diff --git a/toolsrc/src/commands_other.cpp b/toolsrc/src/commands_other.cpp index a8192691d..a4f644c11 100644 --- a/toolsrc/src/commands_other.cpp +++ b/toolsrc/src/commands_other.cpp @@ -95,32 +95,6 @@ namespace vcpkg exit(System::cmd_execute(cmdline)); } - void list_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) - { - args.check_max_args(0); - - std::vector packages_output; - for (auto&& pgh : database_load_check(paths)) - { - if (pgh->state == install_state_t::not_installed && pgh->want == want_t::purge) - continue; - packages_output.push_back(Strings::format("%-27s %-16s %s", - pgh->package.displayname(), - pgh->package.version, - shorten_description(pgh->package.description))); - } - std::sort(packages_output.begin(), packages_output.end()); - for (auto&& package : packages_output) - { - System::println(package.c_str()); - } - if (packages_output.empty()) - { - System::println("No packages are installed. Did you mean `search`?"); - } - exit(EXIT_SUCCESS); - } - void import_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) { if (args.command_arguments.size() != 3) -- cgit v1.2.3