mirror of
https://github.com/sametersoylu/argument-parser.git
synced 2026-05-28 20:08:10 +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()
|
argument::start()
|
||||||
.positional("count")
|
.positional("count")
|
||||||
.position(0)
|
.position(1)
|
||||||
.help_text("How many times to repeat the action.")
|
.help_text("How many times to repeat the action.")
|
||||||
.action<int>([](int const& count) {
|
.action<int>([](int const& count) {
|
||||||
std::cout << "count action configured for " << count << '\n';
|
std::cout << "count action configured for " << count << '\n';
|
||||||
@@ -66,6 +66,13 @@ auto main() -> int {
|
|||||||
.reference(captured_value)
|
.reference(captured_value)
|
||||||
.build(parser);
|
.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>({
|
// parser.add_argument<int>({
|
||||||
// {ShortArgument, "c"},
|
// {ShortArgument, "c"},
|
||||||
// {HelpText, "capture count"},
|
// {HelpText, "capture count"},
|
||||||
|
|||||||
Reference in New Issue
Block a user