mirror of
https://github.com/sametersoylu/argument-parser.git
synced 2026-05-28 20:08:10 +00:00
feat: add reference capabilities to positional arguments. use existing
v2 api to capture reference arguments.
This commit is contained in:
@@ -368,12 +368,8 @@ private:
|
||||
throw std::logic_error("reference() was selected without a target.");
|
||||
}
|
||||
|
||||
pairs[argument_parser::v2::flags::Reference] = target;
|
||||
parser.template add_argument<store_type>(pairs);
|
||||
parser.on_complete([target, key](argument_parser::base_parser const& completed_parser) {
|
||||
if (auto value = completed_parser.template get_optional<store_type>(key)) {
|
||||
*target = value.value();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
auto build_parametered_action(argument_parser::v2::base_parser& parser) const -> void {
|
||||
|
||||
Reference in New Issue
Block a user