[libvirt] [PATCH] virsh: Remove redundant optional option for cmdHelp

Justin Clift jclift at redhat.com
Fri Dec 3 09:17:17 UTC 2010


On 03/12/2010, at 6:34 PM, Osier Yang wrote:
> static const vshCmdOptDef opts_help[] = {
> -    {"command", VSH_OT_DATA, 0, N_("Prints global help or command specific help.")},
> -    {"group", VSH_OT_DATA, 0, N_("Prints global help or help for a group of related commands.")},
> +    {"command-or-group", VSH_OT_DATA, 0, N_("Prints global help, command specific help, or help for a group of related commands")},
>     {NULL, 0, 0, NULL}
> };
> 
> @@ -581,10 +580,7 @@ cmdHelp(vshControl *ctl, const vshCmd *cmd)
>     const vshCmdGrp *g;
>     const char *name;
> 
> -    name = vshCommandOptString(cmd, "command", NULL);
> -
> -    if (!name)
> -        name = vshCommandOptString(cmd, "group", NULL);
> +    name = vshCommandOptString(cmd, "command-or-group", NULL);

NACK.  This breaks backwards compatibility for anyone with scripts already using "--command":

  virsh # help --command domname
  error: command 'help' doesn't support option --command

With 0.8.6:

  virsh # help --command domname
    NAME
      domname - convert a domain id or UUID to domain name

    SYNOPSIS
      domname <domain>

    OPTIONS
      [--domain] <string>  domain id or uuid

Thinking it would be better to show/have "--command" in the allowable options, but never care if it is or isn't specified.  Just make use of the option or group name the user gives.

?





More information about the libvir-list mailing list