#pragma once #include #include #include #include #include #include #include namespace vcpkg { struct ParsedArguments { std::unordered_set switches; std::unordered_map settings; }; struct VcpkgPaths; struct CommandSwitch { std::string name; CStringView short_help_text; }; struct CommandSetting { std::string name; CStringView short_help_text; }; struct CommandOptionsStructure { Span switches; Span settings; }; struct CommandStructure { std::string example_text; size_t minimum_arity; size_t maximum_arity; CommandOptionsStructure options; std::vector (*valid_arguments)(const VcpkgPaths& paths); }; void display_usage(const CommandStructure& command_structure); #if defined(_WIN32) using CommandLineCharType = wchar_t; #else using CommandLineCharType = char; #endif struct VcpkgCmdArguments { static VcpkgCmdArguments create_from_command_line(const int argc, const CommandLineCharType* const* const argv); static VcpkgCmdArguments create_from_arg_sequence(const std::string* arg_begin, const std::string* arg_end); std::unique_ptr vcpkg_root_dir; std::unique_ptr triplet; Optional debug = nullopt; Optional sendmetrics = nullopt; Optional printmetrics = nullopt; std::string command; std::vector command_arguments; ParsedArguments parse_arguments(const CommandStructure& command_structure) const; private: std::unordered_map> optional_command_arguments; }; }