cemu-vcpkg/toolsrc/include/vcpkg/vcpkgcmdarguments.h

78 lines
1.9 KiB
C
Raw Normal View History

2016-09-18 20:50:08 -07:00
#pragma once
#include <vcpkg/base/cstringview.h>
#include <vcpkg/base/optional.h>
#include <vcpkg/base/span.h>
2016-09-18 20:50:08 -07:00
#include <memory>
#include <unordered_map>
2016-09-18 20:50:08 -07:00
#include <unordered_set>
#include <vector>
2016-09-18 20:50:08 -07:00
namespace vcpkg
{
struct ParsedArguments
{
std::unordered_set<std::string> switches;
std::unordered_map<std::string, std::string> settings;
};
struct VcpkgPaths;
struct CommandSwitch
{
std::string name;
CStringView short_help_text;
};
struct CommandSetting
2016-09-18 20:50:08 -07:00
{
std::string name;
CStringView short_help_text;
};
struct CommandOptionsStructure
{
Span<const CommandSwitch> switches;
Span<const CommandSetting> settings;
};
struct CommandStructure
{
std::string example_text;
size_t minimum_arity;
size_t maximum_arity;
CommandOptionsStructure options;
std::vector<std::string> (*valid_arguments)(const VcpkgPaths& paths);
};
#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);
2016-09-18 20:50:08 -07:00
std::unique_ptr<std::string> vcpkg_root_dir;
std::unique_ptr<std::string> triplet;
Optional<bool> debug = nullopt;
Optional<bool> sendmetrics = nullopt;
Optional<bool> printmetrics = nullopt;
2016-09-18 20:50:08 -07:00
std::string command;
std::vector<std::string> command_arguments;
ParsedArguments parse_arguments(const CommandStructure& command_structure) const;
2016-09-18 20:50:08 -07:00
private:
std::unordered_map<std::string, Optional<std::string>> optional_command_arguments;
2016-09-18 20:50:08 -07:00
};
}