diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2017-07-26 13:54:28 -0700 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2017-07-26 14:28:19 -0700 |
| commit | 60296cf16189d4cb048482a1c4476a41d9b18918 (patch) | |
| tree | c8d978a794a028cfe58f61c8a584e07562e66f96 /toolsrc/include | |
| parent | 661f5f9346a6759747c19c36b625c7679317fb11 (diff) | |
| download | vcpkg-60296cf16189d4cb048482a1c4476a41d9b18918.tar.gz vcpkg-60296cf16189d4cb048482a1c4476a41d9b18918.zip | |
[vcpkg] Add support for single-option arguments.
Diffstat (limited to 'toolsrc/include')
| -rw-r--r-- | toolsrc/include/VcpkgCmdArguments.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/toolsrc/include/VcpkgCmdArguments.h b/toolsrc/include/VcpkgCmdArguments.h index 316987100..0de5747b1 100644 --- a/toolsrc/include/VcpkgCmdArguments.h +++ b/toolsrc/include/VcpkgCmdArguments.h @@ -2,11 +2,18 @@ #include "vcpkg_optional.h" #include <memory> +#include <unordered_map> #include <unordered_set> #include <vector> namespace vcpkg { + struct ParsedArguments + { + std::unordered_set<std::string> switches; + std::unordered_map<std::string, std::string> settings; + }; + struct VcpkgCmdArguments { static VcpkgCmdArguments create_from_command_line(const int argc, const wchar_t* const* const argv); @@ -21,7 +28,13 @@ namespace vcpkg std::string command; std::vector<std::string> command_arguments; std::unordered_set<std::string> check_and_get_optional_command_arguments( - const std::vector<std::string>& valid_options) const; + const std::vector<std::string>& valid_options) const + { + return std::move(check_and_get_optional_command_arguments(valid_options, {}).switches); + } + + ParsedArguments check_and_get_optional_command_arguments(const std::vector<std::string>& valid_switches, + const std::vector<std::string>& valid_settings) const; void check_max_arg_count(const size_t expected_arg_count) const; void check_max_arg_count(const size_t expected_arg_count, const std::string& example_text) const; @@ -31,6 +44,6 @@ namespace vcpkg void check_exact_arg_count(const size_t expected_arg_count, const std::string& example_text) const; private: - std::unordered_set<std::string> optional_command_arguments; + std::unordered_map<std::string, Optional<std::string>> optional_command_arguments; }; } |
