commit 62d286a7458f22ec3e0360671d553ad6ff783d57
parent 0a1cd372283614d663d6745b544ca82dfab325f0
Author: Tim Kourt <tim.a.kourt@linux.intel.com>
Date: Wed, 18 Sep 2019 15:18:30 -0700
client: Add '--dontask' command-line option
This option prevents iwctl from prompting user for the secrets
if they were not provided as the command-line arguments.
Diffstat:
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/client/command.c b/client/command.c
@@ -624,6 +624,7 @@ static const struct option command_opts[] = {
{ COMMAND_OPTION_USERNAME, required_argument, NULL, 'u' },
{ COMMAND_OPTION_PASSWORD, required_argument, NULL, 'p' },
{ COMMAND_OPTION_PASSPHRASE, required_argument, NULL, 'P' },
+ { COMMAND_OPTION_DONTASK, no_argument, NULL, 'd' },
{ }
};
@@ -648,7 +649,7 @@ bool command_init(char **argv, int argc)
for (;;) {
struct command_option *option;
- opt = getopt_long(argc, argv, "u:p:P:", command_opts, NULL);
+ opt = getopt_long(argc, argv, "u:p:P:d", command_opts, NULL);
switch (opt) {
case 'u':
@@ -675,6 +676,13 @@ bool command_init(char **argv, int argc)
l_queue_push_tail(command_options, option);
break;
+ case 'd':
+ option = l_new(struct command_option, 1);
+ option->name = COMMAND_OPTION_DONTASK;
+
+ l_queue_push_tail(command_options, option);
+
+ break;
case -1:
goto options_parsed;
case '?':
diff --git a/client/command.h b/client/command.h
@@ -23,6 +23,7 @@
#define COMMAND_OPTION_USERNAME "username"
#define COMMAND_OPTION_PASSWORD "password"
#define COMMAND_OPTION_PASSPHRASE "passphrase"
+#define COMMAND_OPTION_DONTASK "dontask"
typedef char *(*command_completion_func_t) (const char *text, int state);