blob: 194e4b435d85b1a2e38df602573a0af6da7b4ef7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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_exact_arg_count(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);
}
}
|