aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2016-11-07 17:37:08 -0800
committerAlexander Karatarakis <alkarata@microsoft.com>2016-11-07 17:37:08 -0800
commitd78c1a974f1eabe8caf5df36bbd5b55b2dcd701d (patch)
tree5fa436a94f7fb27a4836eb64f9bb41214a6fcb4b
parente7c6f90adc58382d200159ada063204d462937d0 (diff)
downloadvcpkg-d78c1a974f1eabe8caf5df36bbd5b55b2dcd701d.tar.gz
vcpkg-d78c1a974f1eabe8caf5df36bbd5b55b2dcd701d.zip
Move shorten_description to vcpkglib_helpers
-rw-r--r--toolsrc/include/vcpkg.h2
-rw-r--r--toolsrc/include/vcpkglib_helpers.h2
-rw-r--r--toolsrc/src/commands_list.cpp3
-rw-r--r--toolsrc/src/commands_search.cpp3
-rw-r--r--toolsrc/src/vcpkg.cpp8
-rw-r--r--toolsrc/src/vcpkglib_helpers.cpp8
6 files changed, 14 insertions, 12 deletions
diff --git a/toolsrc/include/vcpkg.h b/toolsrc/include/vcpkg.h
index 30d8adbf8..3a8160c71 100644
--- a/toolsrc/include/vcpkg.h
+++ b/toolsrc/include/vcpkg.h
@@ -13,8 +13,6 @@ namespace vcpkg
extern bool g_do_dry_run;
- std::string shorten_description(const std::string& desc);
-
StatusParagraphs database_load_check(const vcpkg_paths& paths);
void install_package(const vcpkg_paths& paths, const BinaryParagraph& binary_paragraph, StatusParagraphs& status_db);
diff --git a/toolsrc/include/vcpkglib_helpers.h b/toolsrc/include/vcpkglib_helpers.h
index 640fab555..019bb8c39 100644
--- a/toolsrc/include/vcpkglib_helpers.h
+++ b/toolsrc/include/vcpkglib_helpers.h
@@ -9,4 +9,6 @@ namespace vcpkg {namespace details
std::string required_field(const std::unordered_map<std::string, std::string>& fields, const std::string& fieldname);
std::string remove_required_field(std::unordered_map<std::string, std::string>* fields, const std::string& fieldname);
+
+ std::string shorten_description(const std::string& desc);
}}
diff --git a/toolsrc/src/commands_list.cpp b/toolsrc/src/commands_list.cpp
index 87aad1991..2d6b42008 100644
--- a/toolsrc/src/commands_list.cpp
+++ b/toolsrc/src/commands_list.cpp
@@ -1,6 +1,7 @@
#include "vcpkg_Commands.h"
#include "vcpkg.h"
#include "vcpkg_System.h"
+#include "vcpkglib_helpers.h"
namespace vcpkg
{
@@ -9,7 +10,7 @@ namespace vcpkg
System::println("%-27s %-16s %s",
pgh.package.displayname(),
pgh.package.version,
- shorten_description(pgh.package.description));
+ details::shorten_description(pgh.package.description));
}
void list_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths)
diff --git a/toolsrc/src/commands_search.cpp b/toolsrc/src/commands_search.cpp
index 399709cf3..38c257f87 100644
--- a/toolsrc/src/commands_search.cpp
+++ b/toolsrc/src/commands_search.cpp
@@ -2,6 +2,7 @@
#include "vcpkg_System.h"
#include "vcpkg.h"
#include "Paragraphs.h"
+#include "vcpkglib_helpers.h"
namespace fs = std::tr2::sys;
@@ -38,7 +39,7 @@ namespace vcpkg
System::println("%-20s %-16s %s",
source_paragraph.name,
source_paragraph.version,
- shorten_description(source_paragraph.description));
+ details::shorten_description(source_paragraph.description));
}
void search_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths)
diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp
index bd02f5424..d9956e789 100644
--- a/toolsrc/src/vcpkg.cpp
+++ b/toolsrc/src/vcpkg.cpp
@@ -64,14 +64,6 @@ static StatusParagraphs load_current_database(const fs::path& vcpkg_dir_status_f
return StatusParagraphs(std::move(status_pghs));
}
-std::string vcpkg::shorten_description(const std::string& desc)
-{
- auto simple_desc = std::regex_replace(desc.substr(0, 49), std::regex("\\n( |\\t)?"), "");
- if (desc.size() > 49)
- simple_desc.append("...");
- return simple_desc;
-}
-
StatusParagraphs vcpkg::database_load_check(const vcpkg_paths& paths)
{
auto updates_dir = paths.vcpkg_dir_updates;
diff --git a/toolsrc/src/vcpkglib_helpers.cpp b/toolsrc/src/vcpkglib_helpers.cpp
index 61dc4f4cc..d104bb19d 100644
--- a/toolsrc/src/vcpkglib_helpers.cpp
+++ b/toolsrc/src/vcpkglib_helpers.cpp
@@ -1,6 +1,7 @@
#include "vcpkg_Checks.h"
#include "vcpkglib_helpers.h"
#include <unordered_map>
+#include <regex>
namespace vcpkg {namespace details
{
@@ -45,4 +46,11 @@ namespace vcpkg {namespace details
return value;
}
+ std::string shorten_description(const std::string& desc)
+ {
+ auto simple_desc = std::regex_replace(desc.substr(0, 49), std::regex("\\n( |\\t)?"), "");
+ if (desc.size() > 49)
+ simple_desc.append("...");
+ return simple_desc;
+ }
}}