diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2016-09-30 16:54:07 -0700 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2016-09-30 16:54:07 -0700 |
| commit | 4b0f3d87befb84c819afbf664614281491a784b9 (patch) | |
| tree | e36c167739be60fec7f4704939936506bc1de86e | |
| parent | d31498d0e7c22251b22594763d91c9f36a32629a (diff) | |
| download | vcpkg-4b0f3d87befb84c819afbf664614281491a784b9.tar.gz vcpkg-4b0f3d87befb84c819afbf664614281491a784b9.zip | |
Introduce Input::check_triplet()
| -rw-r--r-- | toolsrc/include/vcpkg_Input.h | 4 | ||||
| -rw-r--r-- | toolsrc/src/main.cpp | 9 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg_Input.cpp | 13 |
3 files changed, 18 insertions, 8 deletions
diff --git a/toolsrc/include/vcpkg_Input.h b/toolsrc/include/vcpkg_Input.h index 7041001c8..311df3bec 100644 --- a/toolsrc/include/vcpkg_Input.h +++ b/toolsrc/include/vcpkg_Input.h @@ -1,11 +1,13 @@ #pragma once #include <vector> -#include <string> #include "package_spec.h" +#include "vcpkg_paths.h" namespace vcpkg {namespace Input { package_spec check_and_get_package_spec(const std::string& package_spec_as_string, const triplet& default_target_triplet, const char* example_text); std::vector<package_spec> check_and_get_package_specs(const std::vector<std::string>& package_specs_as_strings, const triplet& default_target_triplet, const char* example_text); + + void check_triplet(const triplet& t, const vcpkg_paths& paths); }} diff --git a/toolsrc/src/main.cpp b/toolsrc/src/main.cpp index a317330ff..b49f2bdef 100644 --- a/toolsrc/src/main.cpp +++ b/toolsrc/src/main.cpp @@ -11,6 +11,7 @@ #include <Shlobj.h> #include "vcpkg_Files.h" #include "vcpkg_System.h" +#include "vcpkg_Input.h" using namespace vcpkg; @@ -87,13 +88,7 @@ static void inner(const vcpkg_cmd_arguments& args) } } - if (!paths.is_valid_triplet(default_target_triplet)) - { - System::println(System::color::error, "Error: invalid triplet: %s", default_target_triplet.value); - TrackProperty("error", "invalid triplet: " + default_target_triplet.value); - help_topic_valid_triplet(paths); - exit(EXIT_FAILURE); - } + Input::check_triplet(default_target_triplet, paths); if (auto command_function = find_command(args.command, get_available_commands_type_a())) { diff --git a/toolsrc/src/vcpkg_Input.cpp b/toolsrc/src/vcpkg_Input.cpp index de5890da1..09fce7b8c 100644 --- a/toolsrc/src/vcpkg_Input.cpp +++ b/toolsrc/src/vcpkg_Input.cpp @@ -1,5 +1,7 @@ #include "vcpkg_Input.h" #include "vcpkg_System.h" +#include "metrics.h" +#include "vcpkg_Commands.h" namespace vcpkg {namespace Input { @@ -26,4 +28,15 @@ namespace vcpkg {namespace Input return specs; } + + void check_triplet(const triplet& t, const vcpkg_paths& paths) + { + if (!paths.is_valid_triplet(t)) + { + System::println(System::color::error, "Error: invalid triplet: %s", t.value); + TrackProperty("error", "invalid triplet: " + t.value); + help_topic_valid_triplet(paths); + exit(EXIT_FAILURE); + } + } }} |
