mirror of
https://github.com/sametersoylu/argument-parser.git
synced 2026-05-28 20:08:10 +00:00
chore: deduplicate builtin help action generation.
This commit is contained in:
@@ -92,6 +92,16 @@ namespace argument_parser::v2 {
|
||||
using argument_parser::base_parser::current_conventions;
|
||||
using argument_parser::base_parser::reset_current_conventions;
|
||||
|
||||
void prepare_help_flag() {
|
||||
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."}});
|
||||
}
|
||||
|
||||
private:
|
||||
template <bool IsTyped, typename ActionType, typename T, typename ArgsMap>
|
||||
void add_argument_impl(ArgsMap const &argument_pairs) {
|
||||
|
||||
Reference in New Issue
Block a user