mirror of
https://github.com/cemu-project/vcpkg.git
synced 2025-02-23 11:07:10 +01:00
Place command_list() in a separate cpp file
This commit is contained in:
parent
aeab2fee87
commit
97b79e1f0c
32
toolsrc/src/commands_list.cpp
Normal file
32
toolsrc/src/commands_list.cpp
Normal file
@ -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<std::string> 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);
|
||||
}
|
||||
}
|
@ -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<std::string> 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)
|
||||
|
@ -129,6 +129,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\commands_cache.cpp" />
|
||||
<ClCompile Include="..\src\commands_list.cpp" />
|
||||
<ClCompile Include="..\src\commands_remove.cpp" />
|
||||
<ClCompile Include="..\src\commands_search.cpp" />
|
||||
<ClCompile Include="..\src\commands_update.cpp" />
|
||||
|
@ -51,6 +51,9 @@
|
||||
<ClCompile Include="..\src\commands_update.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\commands_list.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\post_build_lint.h">
|
||||
|
Loading…
x
Reference in New Issue
Block a user