3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 13:02:44 +01:00

client: Argument completion for known-networks

This commit is contained in:
Tim Kourt 2017-04-21 11:14:54 -07:00 committed by Denis Kenzior
parent 8cdfd1e460
commit 21687e9a81

View File

@ -48,10 +48,35 @@ static const struct command known_networks_commands[] = {
{ } { }
}; };
static char *family_arg_completion(const char *text, int state)
{
static size_t index;
static size_t len;
const char *cmd;
if (!state) {
index = 0;
len = strlen(text);
}
while ((cmd = known_networks_commands[index].cmd)) {
if (known_networks_commands[index++].entity)
continue;
if (strncmp(cmd, text, len))
continue;
return l_strdup(cmd);
}
return NULL;
}
static struct command_family known_networks_command_family = { static struct command_family known_networks_command_family = {
.caption = "Known Networks", .caption = "Known Networks",
.name = "known-networks", .name = "known-networks",
.command_list = known_networks_commands, .command_list = known_networks_commands,
.family_arg_completion = family_arg_completion,
}; };
static int known_networks_command_family_init(void) static int known_networks_command_family_init(void)