mirror of
https://github.com/sametersoylu/argument-parser.git
synced 2026-05-28 11:58:12 +00:00
update: example to display capturing capability via positional args.
This commit is contained in:
@@ -52,7 +52,7 @@ auto main() -> int {
|
||||
|
||||
argument::start()
|
||||
.positional("count")
|
||||
.position(0)
|
||||
.position(1)
|
||||
.help_text("How many times to repeat the action.")
|
||||
.action<int>([](int const& count) {
|
||||
std::cout << "count action configured for " << count << '\n';
|
||||
@@ -66,6 +66,13 @@ auto main() -> int {
|
||||
.reference(captured_value)
|
||||
.build(parser);
|
||||
|
||||
argument::start()
|
||||
.positional("captured")
|
||||
.position(0)
|
||||
.help_text("Store the parsed value through a reference.")
|
||||
.reference(captured_value)
|
||||
.build(parser);
|
||||
|
||||
// parser.add_argument<int>({
|
||||
// {ShortArgument, "c"},
|
||||
// {HelpText, "capture count"},
|
||||
|
||||
Reference in New Issue
Block a user