mirror of
https://github.com/sametersoylu/argument-parser.git
synced 2026-04-13 03:41:18 +00:00
chore: deduplicate builtin help action generation.
This commit is contained in:
@@ -25,13 +25,7 @@ namespace argument_parser {
|
||||
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."}});
|
||||
prepare_help_flag();
|
||||
}
|
||||
} // namespace v2
|
||||
} // namespace argument_parser
|
||||
|
||||
@@ -25,13 +25,7 @@ namespace argument_parser {
|
||||
}
|
||||
}
|
||||
|
||||
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."}});
|
||||
prepare_help_flag();
|
||||
}
|
||||
} // namespace v2
|
||||
} // namespace argument_parser
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include "windows_parser.hpp"
|
||||
#include "argument_parser.hpp"
|
||||
#include "parser_v2.hpp"
|
||||
|
||||
#include <Windows.h>
|
||||
#include <iostream>
|
||||
@@ -100,13 +99,7 @@ namespace argument_parser::v2 {
|
||||
parse_windows_arguments(ref_parsed_args(),
|
||||
[this](std::string const &program_name) { this->set_program_name(program_name); });
|
||||
|
||||
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."}});
|
||||
prepare_help_flag();
|
||||
}
|
||||
} // namespace argument_parser::v2
|
||||
|
||||
|
||||
Reference in New Issue
Block a user