25inline namespace util {
29: description_{
std::
move(description)}
35 return opts_.count(long_opt);
40 return opts_.count(std::string_view{&short_opt, 1});
47 while (!
lex.empty()) {
48 const auto opt =
lex.
opt();
51 OptsMap::iterator
it{opts_.end()};
57 throw runtime_error{
"unexpected argument: " +
string{
lex.arg()}};
63 throw runtime_error{
"unknown option: " +
string{opt}};
70 cout << *
this <<
"\n";
78 const auto val =
lex.pop_value();
79 if (arg.set_ && !arg.multitoken_) {
80 throw runtime_error{
"duplicate option: " +
string{opt}};
84 [&](
const NoOp&) {
lex.pop(); }},
90 for (
const auto&
data : opts_) {
92 [&](
const Value& arg) {
94 throw runtime_error{
"missing required option: "
95 +
data.second->opt()};
100 for (
const auto&
data : positional_) {
102 [&](
const Value& arg) {
104 throw runtime_error{
"missing positional argument"};
Command-line options parser.