feat(convention) add windows style argument conventions.

This commit is contained in:
2025-10-07 02:08:25 +04:00
parent 1a62552ee0
commit fea5042af7
5 changed files with 113 additions and 6 deletions

View File

@@ -194,12 +194,18 @@ namespace argument_parser {
}
argument& get_argument(conventions::parsed_argument const& arg) {
if (arg.first == conventions::argument_type::LONG) {
auto long_pos = long_arguments.find(arg.second);
if (long_pos != long_arguments.end()) return argument_map.at(long_pos->second);
} else if (arg.first == conventions::argument_type::SHORT) {
auto short_pos = short_arguments.find(arg.second);
if (short_pos != short_arguments.end()) return argument_map.at(short_pos->second);
} else if (arg.first == conventions::argument_type::INTERCHANGABLE) {
auto long_pos = long_arguments.find(arg.second);
if (long_pos != long_arguments.end()) return argument_map.at(long_pos->second);
auto short_pos = short_arguments.find(arg.second);
if (short_pos != short_arguments.end()) return argument_map.at(short_pos->second);
}
throw std::runtime_error("Unknown argument: " + arg.second);
}