3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 06:29:23 +01:00

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.
This commit is contained in:
Tim Kourt 2019-09-18 15:18:30 -07:00 committed by Denis Kenzior
parent 0a1cd37228
commit 62d286a745
2 changed files with 10 additions and 1 deletions

View File

@ -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':
@ -674,6 +675,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;

View File

@ -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);