feat: add help command to linux and macos parsers.

This commit is contained in:
2026-03-16 18:46:47 +04:00
parent a8b7078949
commit ddb2d0bf10
4 changed files with 18 additions and 0 deletions

View File

@@ -24,6 +24,14 @@ namespace argument_parser {
for (std::string line; std::getline(command_line_file, line, '\0');) {
parsed_arguments.emplace_back(line);
}
add_argument({{flags::ShortArgument, "h"},
{flags::LongArgument, "help"},
{flags::Action, helpers::make_non_parametered_action([this]() {
this->display_help(this->current_conventions());
std::exit(0);
})},
{flags::HelpText, "Prints this help text."}});
}
} // namespace v2
} // namespace argument_parser

View File

@@ -24,6 +24,14 @@ namespace argument_parser {
ref_parsed_args().emplace_back(argv[i]);
}
}
add_argument({{flags::ShortArgument, "h"},
{flags::LongArgument, "help"},
{flags::Action, helpers::make_non_parametered_action([this]() {
this->display_help(this->current_conventions());
std::exit(0);
})},
{flags::HelpText, "Prints this help text."}});
}
} // namespace v2
} // namespace argument_parser