mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 13:02:44 +01:00
client: Entity argument completion
This commit is contained in:
parent
c85ea2f924
commit
02b52adf61
@ -253,6 +253,31 @@ done:
|
||||
return matches;
|
||||
}
|
||||
|
||||
char *command_entity_arg_completion(const char *text, int state,
|
||||
const struct command *command_list)
|
||||
{
|
||||
static size_t index;
|
||||
static size_t len;
|
||||
const char *cmd;
|
||||
|
||||
if (!state) {
|
||||
index = 0;
|
||||
len = strlen(text);
|
||||
}
|
||||
|
||||
while ((cmd = command_list[index].cmd)) {
|
||||
if (!command_list[index++].entity)
|
||||
continue;
|
||||
|
||||
if (strncmp(cmd, text, len))
|
||||
continue;
|
||||
|
||||
return l_strdup(cmd);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void execute_cmd(const char *family, const char *entity,
|
||||
const struct command *cmd, char *args)
|
||||
{
|
||||
|
@ -41,6 +41,8 @@ struct command_family {
|
||||
};
|
||||
|
||||
char **command_completion(const char *text, int start, int end);
|
||||
char *command_entity_arg_completion(const char *text, int state,
|
||||
const struct command *command_list);
|
||||
|
||||
void command_process_prompt(char *prompt);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user