2016-09-18 20:50:08 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
#include <unordered_set>
|
2017-04-03 14:43:44 -07:00
|
|
|
#include "OptBool.h"
|
2016-09-18 20:50:08 -07:00
|
|
|
|
|
|
|
namespace vcpkg
|
|
|
|
{
|
2017-04-03 16:00:17 -07:00
|
|
|
struct VcpkgCmdArguments
|
2016-09-18 20:50:08 -07:00
|
|
|
{
|
2017-04-03 16:00:17 -07:00
|
|
|
static VcpkgCmdArguments create_from_command_line(const int argc, const wchar_t* const* const argv);
|
|
|
|
static VcpkgCmdArguments create_from_arg_sequence(const std::string* arg_begin, const std::string* arg_end);
|
2016-09-18 20:50:08 -07:00
|
|
|
|
|
|
|
std::unique_ptr<std::string> vcpkg_root_dir;
|
2017-04-10 13:01:43 -07:00
|
|
|
std::unique_ptr<std::string> triplet;
|
2017-04-25 17:01:21 -07:00
|
|
|
OptBool debug = OptBoolC::UNSPECIFIED;
|
|
|
|
OptBool sendmetrics = OptBoolC::UNSPECIFIED;
|
|
|
|
OptBool printmetrics = OptBoolC::UNSPECIFIED;
|
2016-09-18 20:50:08 -07:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
2016-09-30 11:24:04 -07:00
|
|
|
void check_max_arg_count(const size_t expected_arg_count) const;
|
2016-12-12 15:03:36 -08:00
|
|
|
void check_max_arg_count(const size_t expected_arg_count, const std::string& example_text) const;
|
2016-09-30 11:24:04 -07:00
|
|
|
void check_min_arg_count(const size_t expected_arg_count) const;
|
2016-12-12 15:03:36 -08:00
|
|
|
void check_min_arg_count(const size_t expected_arg_count, const std::string& example_text) const;
|
2016-09-30 11:24:04 -07:00
|
|
|
void check_exact_arg_count(const size_t expected_arg_count) const;
|
2016-12-12 15:03:36 -08:00
|
|
|
void check_exact_arg_count(const size_t expected_arg_count, const std::string& example_text) const;
|
2016-09-30 11:24:04 -07:00
|
|
|
|
2016-09-18 20:50:08 -07:00
|
|
|
private:
|
|
|
|
std::unordered_set<std::string> optional_command_arguments;
|
|
|
|
};
|
|
|
|
}
|