You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How does it solve my use case?
My goal is to call parse multiple times, for example
User calls program with arguments ./my_program --template=basic --basic_option1=value1
In lua we define argument --template to argparse
Call a hypothetical parse_known_args to parse only arguments we defined and ignore others (because right now parse() fails if encounters unknown args)
Then depending on value of passed template argument we add additional arguments to argparse, using parser:option("--basic_option1", "Option 1")
And then call parse() again and receiving a complete set of user-specified arguments.
This is also useful with the help messages - collect all arguments and only then display all valid options even if user specified template, i.e. ./my_program --template=basic -h
Activity
[-]Support parsing only known arguments[/-][+]Support parsing arguments partially[/+]iridiumlynx commentedon Sep 28, 2018
igorcoding, there is mutex(...) method for your use-case.
igorcoding commentedon Sep 30, 2018
How does it solve my use case?
My goal is to call parse multiple times, for example
./my_program --template=basic --basic_option1=value1--templateto argparseparse_known_argsto parse only arguments we defined and ignore others (because right now parse() fails if encounters unknown args)templateargument we add additional arguments to argparse, usingparser:option("--basic_option1", "Option 1")This is also useful with the help messages - collect all arguments and only then display all valid options even if user specified template, i.e.
./my_program --template=basic -h