mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-29 03:34:26 +08:00
[vcpkg] Improve formatting of search and list. Fix gl2ps version.
This commit is contained in:
parent
651ab5cef2
commit
687ea82f89
@ -1,4 +1,4 @@
|
||||
Source: gl2ps
|
||||
Version: OpenGL to PostScript Printing Library
|
||||
Description:
|
||||
Version: 1.4.0
|
||||
Description: OpenGL to PostScript Printing Library
|
||||
Build-Depends: freeglut, zlib, libpng
|
||||
|
@ -36,5 +36,5 @@ namespace vcpkg
|
||||
const fs::path& cmake_script,
|
||||
const std::vector<CMakeVariable>& pass_variables);
|
||||
|
||||
std::string shorten_description(const std::string& desc);
|
||||
std::string shorten_text(const std::string& desc, size_t length);
|
||||
} // namespace vcpkg
|
||||
|
@ -12,14 +12,14 @@ namespace vcpkg::Commands::List
|
||||
{
|
||||
if (FullDesc)
|
||||
{
|
||||
System::println("%-27s %-16s %s", pgh.package.displayname(), pgh.package.version, pgh.package.description);
|
||||
System::println("%-30s %-16s %s", pgh.package.displayname(), pgh.package.version, pgh.package.description);
|
||||
}
|
||||
else
|
||||
{
|
||||
System::println("%-27s %-16s %s",
|
||||
pgh.package.displayname(),
|
||||
pgh.package.version,
|
||||
vcpkg::shorten_description(pgh.package.description));
|
||||
System::println("%-30s %-16s %s",
|
||||
vcpkg::shorten_text(pgh.package.displayname(), 30),
|
||||
vcpkg::shorten_text(pgh.package.version, 16),
|
||||
vcpkg::shorten_text(pgh.package.description, 71));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,9 +57,9 @@ namespace vcpkg::Commands::Search
|
||||
else
|
||||
{
|
||||
System::println("%-20s %-16s %s",
|
||||
source_paragraph.name,
|
||||
source_paragraph.version,
|
||||
vcpkg::shorten_description(source_paragraph.description));
|
||||
vcpkg::shorten_text(source_paragraph.name, 20),
|
||||
vcpkg::shorten_text(source_paragraph.version, 16),
|
||||
vcpkg::shorten_text(source_paragraph.description, 81));
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,8 +72,8 @@ namespace vcpkg::Commands::Search
|
||||
else
|
||||
{
|
||||
System::println("%-37s %s",
|
||||
name + "[" + feature_paragraph.name + "]",
|
||||
vcpkg::shorten_description(feature_paragraph.description));
|
||||
vcpkg::shorten_text(name + "[" + feature_paragraph.name + "]", 37),
|
||||
vcpkg::shorten_text(feature_paragraph.description, 81));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -240,9 +240,10 @@ namespace vcpkg
|
||||
LR"("%s" %s -P "%s")", cmake_exe.native(), cmd_cmake_pass_variables, cmake_script.generic_wstring());
|
||||
}
|
||||
|
||||
std::string shorten_description(const std::string& desc)
|
||||
std::string shorten_text(const std::string& desc, size_t length)
|
||||
{
|
||||
Checks::check_exit(VCPKG_LINE_INFO, length >= 3);
|
||||
auto simple_desc = std::regex_replace(desc, std::regex("\\s+"), " ");
|
||||
return simple_desc.size() <= 52 ? simple_desc : simple_desc.substr(0, 49) + "...";
|
||||
return simple_desc.size() <= length ? simple_desc : simple_desc.substr(0, length - 3) + "...";
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user