aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-08-22 15:59:27 -0700
committerRobert Schumacher <roschuma@microsoft.com>2017-08-22 15:59:27 -0700
commit687ea82f89504520e2a4c60feeb5c0bf6260a4de (patch)
treee34dd8921c508ad4f8f58e16a36023cde6b26c54 /toolsrc/src
parent651ab5cef2c9742869185a181e1db529dc937d21 (diff)
downloadvcpkg-687ea82f89504520e2a4c60feeb5c0bf6260a4de.tar.gz
vcpkg-687ea82f89504520e2a4c60feeb5c0bf6260a4de.zip
[vcpkg] Improve formatting of search and list. Fix gl2ps version.
Diffstat (limited to 'toolsrc/src')
-rw-r--r--toolsrc/src/commands_list.cpp10
-rw-r--r--toolsrc/src/commands_search.cpp10
-rw-r--r--toolsrc/src/vcpkglib.cpp5
3 files changed, 13 insertions, 12 deletions
diff --git a/toolsrc/src/commands_list.cpp b/toolsrc/src/commands_list.cpp
index 9bc9bcc08..3cfa7e184 100644
--- a/toolsrc/src/commands_list.cpp
+++ b/toolsrc/src/commands_list.cpp
@@ -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));
}
}
diff --git a/toolsrc/src/commands_search.cpp b/toolsrc/src/commands_search.cpp
index f12c25fb6..b1bd7ea6f 100644
--- a/toolsrc/src/commands_search.cpp
+++ b/toolsrc/src/commands_search.cpp
@@ -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));
}
}
diff --git a/toolsrc/src/vcpkglib.cpp b/toolsrc/src/vcpkglib.cpp
index 428ae090d..6e90695de 100644
--- a/toolsrc/src/vcpkglib.cpp
+++ b/toolsrc/src/vcpkglib.cpp
@@ -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) + "...";
}
}