mirror of
https://github.com/albfan/miraclecast.git
synced 2025-03-09 23:38:56 +00:00
Improve autocompletion
Standardize help commands Add autocompletion for short arguments Install autocompletion
This commit is contained in:
parent
2aeec41290
commit
a9da0067e3
9 changed files with 115 additions and 28 deletions
|
|
@ -93,13 +93,10 @@ void cli_printf(const char *fmt, ...)
|
|||
va_end(args);
|
||||
}
|
||||
|
||||
int cli_help(const struct cli_cmd *cmds)
|
||||
int cli_help(const struct cli_cmd *cmds, int whitespace)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (!is_cli()) {
|
||||
cli_fn_help();
|
||||
}
|
||||
cli_printf("Available commands:\n");
|
||||
|
||||
for (i = 0; cmds[i].cmd; ++i) {
|
||||
|
|
@ -112,7 +109,7 @@ int cli_help(const struct cli_cmd *cmds)
|
|||
|
||||
cli_printf(" %s %-*s %s\n",
|
||||
cmds[i].cmd,
|
||||
(int)(40 - strlen(cmds[i].cmd)),
|
||||
(int)(whitespace - strlen(cmds[i].cmd)),
|
||||
cmds[i].args ? : "",
|
||||
cmds[i].desc ? : "");
|
||||
}
|
||||
|
|
@ -173,7 +170,7 @@ int cli_do(const struct cli_cmd *cmds, char **args, unsigned int n)
|
|||
}
|
||||
|
||||
if (!strcmp(cmd, "help"))
|
||||
return cli_help(cmds);
|
||||
return cli_help(cmds, 40);
|
||||
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue