update: example to display capturing capability via positional args.

This commit is contained in:
2026-05-05 11:58:50 +04:00
parent 54415f9527
commit c067bbca38

View File

@@ -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"},