[libvirt] [PATCH 4/4] virsh: Create completer for help command
Eric Blake
eblake at redhat.com
Tue Jul 5 23:48:06 UTC 2011
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 at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110705/225a9c44/attachment-0001.sig>
More information about the libvir-list
mailing list