[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 4/4] virsh: Create completer for help command



On 07/04/2011 02:41 AM, Michal Privoznik wrote:
> This completer returns command names and group keywords as well.
> ---
>  tools/virsh.c |   43 ++++++++++++++++++++++++++++++++++++++++++-
>  1 files changed, 42 insertions(+), 1 deletions(-)
> 
> diff --git a/tools/virsh.c b/tools/virsh.c
> index 6a63363..f30d51c 100644
> --- a/tools/virsh.c
> +++ b/tools/virsh.c
> @@ -712,6 +712,46 @@ complt_listAllDomains(const char *text, int state)
>      return complt_listDomainsFlags(text, state, ACTIVE | INACTIVE);
>  }
>  
> +static char *
> +complt_listCmdsAndGroups(const char *text, int state)

This function is nice,

> @@ -12002,7 +12042,8 @@ static const vshCmdDef virshCmds[] = {
>      {"cd", cmdCd, opts_cd, info_cd, VSH_CMD_FLAG_NOCONNECT, NULL},
>      {"echo", cmdEcho, opts_echo, info_echo, VSH_CMD_FLAG_NOCONNECT, NULL},
>      {"exit", cmdQuit, NULL, info_quit, VSH_CMD_FLAG_NOCONNECT, NULL},
> -    {"help", cmdHelp, opts_help, info_help, VSH_CMD_FLAG_NOCONNECT, NULL},
> +    {"help", cmdHelp, opts_help, info_help,
> +     VSH_CMD_FLAG_NOCONNECT, complt_listCmdsAndGroups},

but rather than tying it to cmdHelp, I think it makes more sense to tie
it to a VSH_OT_COMMAND option type.

-- 
Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]