refactor(argument_parser): improve argument handling and cleanup code
- Add new template method for argument addition with type - Handle optional values more safely in get_optional - Remove commented test code from main.cpp
This commit is contained in:
@@ -105,10 +105,9 @@ auto make_grep_action(argument_parser::base_parser& parser) {
|
||||
}
|
||||
|
||||
int main() {
|
||||
// std::vector<std::string> fake_args = { "-g", "add", "-f", "src/main.cpp", "-ep", "1,2" };
|
||||
// auto parser = argument_parser::fake_parser{"test", std::move(fake_args)};
|
||||
auto parser = argument_parser::parser{};
|
||||
auto [file, grep] = make_grep_action(parser);
|
||||
|
||||
parser.add_argument("e", "echo", "echoes given variable", echo, false);
|
||||
parser.add_argument("ep", "echo-point", "echoes given point", echo_point, false);
|
||||
parser.add_argument("f", "file", "File to grep, required only if using grep", file, false);
|
||||
|
||||
Reference in New Issue
Block a user