diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2017-10-13 20:58:00 -0700 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2017-10-13 20:58:00 -0700 |
| commit | bea4c2ff4936f22b4024c2afef5e403533c7b291 (patch) | |
| tree | 22e741611a8abf96d1301b52dc89813faf218250 /toolsrc/include | |
| parent | 0d7381ba408e4d5bcde06ab7a6353ff14e7afc0b (diff) | |
| download | vcpkg-bea4c2ff4936f22b4024c2afef5e403533c7b291.tar.gz vcpkg-bea4c2ff4936f22b4024c2afef5e403533c7b291.zip | |
[vcpkg] Begin refactor to use CommandStructure to represent command parsing
Diffstat (limited to 'toolsrc/include')
| -rw-r--r-- | toolsrc/include/vcpkg/install.h | 2 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/remove.h | 2 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/vcpkgcmdarguments.h | 17 |
3 files changed, 21 insertions, 0 deletions
diff --git a/toolsrc/include/vcpkg/install.h b/toolsrc/include/vcpkg/install.h index 02600b7f5..72643ff37 100644 --- a/toolsrc/include/vcpkg/install.h +++ b/toolsrc/include/vcpkg/install.h @@ -65,5 +65,7 @@ namespace vcpkg::Install const VcpkgPaths& paths, StatusParagraphs& status_db); + extern const CommandStructure INSTALL_COMMAND_STRUCTURE; + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); } diff --git a/toolsrc/include/vcpkg/remove.h b/toolsrc/include/vcpkg/remove.h index f4d381ca3..04f2461be 100644 --- a/toolsrc/include/vcpkg/remove.h +++ b/toolsrc/include/vcpkg/remove.h @@ -19,6 +19,8 @@ namespace vcpkg::Remove const Purge purge, StatusParagraphs& status_db); + extern const CommandStructure REMOVE_COMMAND_STRUCTURE; + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); void remove_package(const VcpkgPaths& paths, const PackageSpec& spec, StatusParagraphs* status_db); } diff --git a/toolsrc/include/vcpkg/vcpkgcmdarguments.h b/toolsrc/include/vcpkg/vcpkgcmdarguments.h index 6c47b98f6..8b1d766b6 100644 --- a/toolsrc/include/vcpkg/vcpkgcmdarguments.h +++ b/toolsrc/include/vcpkg/vcpkgcmdarguments.h @@ -1,6 +1,8 @@ #pragma once +#include <vcpkg/base/cstringview.h> #include <vcpkg/base/optional.h> +#include <vcpkg/base/span.h> #include <memory> #include <unordered_map> @@ -47,4 +49,19 @@ namespace vcpkg private: std::unordered_map<std::string, Optional<std::string>> optional_command_arguments; }; + + struct VcpkgPaths; + + struct CommandStructure + { + CStringView example_text; + + size_t minimum_arity; + size_t maximum_arity; + + Span<const std::string> switches; + Span<const std::string> settings; + + std::vector<std::string> (*valid_arguments)(const VcpkgPaths& paths); + }; } |
