add verbose option
This commit is contained in:
parent
1a92f2b22a
commit
4b245d717b
2 changed files with 13 additions and 2 deletions
|
|
@ -44,6 +44,7 @@ static struct argp_option options[] =
|
|||
{"pipe", 'p', 0, 0, "run in pipe mode" },
|
||||
{"serial", 's', "[NUMBER]", 0, "serial number of device to connect to"},
|
||||
{"list", 'l', 0, 0, "list commands"},
|
||||
{"verbose", 'v', 0, 0, "enable verbose debug prints"},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
|
@ -61,6 +62,7 @@ struct config
|
|||
char* commands[MAX_COMMANDS];
|
||||
size_t command_count;
|
||||
bool list_commands;
|
||||
bool verbose;
|
||||
};
|
||||
|
||||
static error_t parse_opt (int key, char *arg, struct argp_state *state)
|
||||
|
|
@ -89,6 +91,9 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state)
|
|||
case 'l':
|
||||
config->list_commands = true;
|
||||
break;
|
||||
case 'v':
|
||||
config->verbose = true;
|
||||
break;
|
||||
case ARGP_KEY_ARG:
|
||||
{
|
||||
if(config->command_count+1 > MAX_COMMANDS)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue