-
Notifications
You must be signed in to change notification settings - Fork 136
Open
Description
Hi! Could a flag be used with parameter and without parameter simultaneously?
For example smth like:
#define INT_DEFAULT_VALUE 10
OPT_BOOLEAN('f', "force", &force, "force to do", NULL, 0, 0),
OPT_INTEGER('i', "int", &int_num, "selected integer", NULL, 0, 0), //some way to transfer INT_DEFAULT_VALUE inside parser
my cmd -i 15 -f
force: 1
int_num: 15
Now it outputs next string:
my cmd -i -f
[int_num: 15](error: option
-iexpects an integer value)
But could the parameter be used with a default value like this:
my cmd -i -f
force: 1
int_num: 10
Electronshik
Metadata
Metadata
Assignees
Labels
No labels