wpa_cli: Completion for remove, select, disable, enable network

Add command completion routines for remove_network, select_network,
disable_network, and enable_network commands.

Signed-off-by: Mikael Kanstrup <mikael.kanstrup@sonymobile.com>
This commit is contained in:
Mikael Kanstrup 2015-03-24 17:10:39 +01:00 committed by Jouni Malinen
parent 7e6cc90805
commit 1ca6c0f1f1

View File

@ -1619,6 +1619,15 @@ static char ** wpa_cli_complete_network(const char *str, int pos)
} }
static char ** wpa_cli_complete_network_id(const char *str, int pos)
{
int arg = get_cmd_arg_num(str, pos);
if (arg == 1)
return cli_txt_list_array(&networks);
return NULL;
}
static int wpa_cli_cmd_dup_network(struct wpa_ctrl *ctrl, int argc, static int wpa_cli_cmd_dup_network(struct wpa_ctrl *ctrl, int argc,
char *argv[]) char *argv[])
{ {
@ -2876,19 +2885,23 @@ static struct wpa_cli_cmd wpa_cli_commands[] = {
{ "list_networks", wpa_cli_cmd_list_networks, NULL, { "list_networks", wpa_cli_cmd_list_networks, NULL,
cli_cmd_flag_none, cli_cmd_flag_none,
"= list configured networks" }, "= list configured networks" },
{ "select_network", wpa_cli_cmd_select_network, NULL, { "select_network", wpa_cli_cmd_select_network,
wpa_cli_complete_network_id,
cli_cmd_flag_none, cli_cmd_flag_none,
"<network id> = select a network (disable others)" }, "<network id> = select a network (disable others)" },
{ "enable_network", wpa_cli_cmd_enable_network, NULL, { "enable_network", wpa_cli_cmd_enable_network,
wpa_cli_complete_network_id,
cli_cmd_flag_none, cli_cmd_flag_none,
"<network id> = enable a network" }, "<network id> = enable a network" },
{ "disable_network", wpa_cli_cmd_disable_network, NULL, { "disable_network", wpa_cli_cmd_disable_network,
wpa_cli_complete_network_id,
cli_cmd_flag_none, cli_cmd_flag_none,
"<network id> = disable a network" }, "<network id> = disable a network" },
{ "add_network", wpa_cli_cmd_add_network, NULL, { "add_network", wpa_cli_cmd_add_network, NULL,
cli_cmd_flag_none, cli_cmd_flag_none,
"= add a network" }, "= add a network" },
{ "remove_network", wpa_cli_cmd_remove_network, NULL, { "remove_network", wpa_cli_cmd_remove_network,
wpa_cli_complete_network_id,
cli_cmd_flag_none, cli_cmd_flag_none,
"<network id> = remove a network" }, "<network id> = remove a network" },
{ "set_network", wpa_cli_cmd_set_network, wpa_cli_complete_network, { "set_network", wpa_cli_cmd_set_network, wpa_cli_complete_network,