[libvirt] [PATCH] virsh: tweak help output for VSH_OT_DATA

https://bugzilla.redhat.com/show_bug.cgi?id=609044 complained that 'virsh help pool-create-as' didn't document the shortcut that you can do 'virsh pool-create-as $name $type --target $target' rather than having to supply the four optional source- arguments in order to fill out the necessary positional arguments. This one-liner changes the help output to hopefully make this more obvious: NAME pool-create-as - create a pool from a set of args SYNOPSIS pool-create-as <name> [--print-xml] <type> [<source-host>] [<source-path>] [<source-dev>] [<source-name>] [<target>] [--source-format <string>] DESCRIPTION Create a pool. OPTIONS [--name] <string> name of the pool --print-xml print XML document, but don't define/create [--type] <string> type of the pool [--source-host] <string> source-host for underlying storage [--source-path] <string> source path for underlying storage [--source-dev] <string> source device for underlying storage [--source-name] <string> source name for underlying storage [--target] <string> target for underlying storage --source-format <string> format for underlying storage * tools/virsh.c (vshCmddefHelp): Make it more obvious that data arguments may, but not must, be specified by option leaders. --- Wow - the commit message is 30 times bigger than the commit itself! If additionally wanted, I could make the help output wrap if the left column is long, so that the right column lines up, looking more like: OPTIONS [--name] <string> name of the pool --print-xml print XML document, but don't define/create [--type] <string> type of the pool [--source-host] <string> source-host for underlying storage [--source-path] <string> source path for underlying storage [--source-dev] <string> source device for underlying storage [--source-name] <string> source name for underlying storage [--target] <string> target for underlying storage --source-format <string> format for underlying storage tools/virsh.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index f1bb295..cdac9c0 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -9558,7 +9558,7 @@ vshCmddefHelp(vshControl *ctl, const char *cmdname) else if (opt->type == VSH_OT_STRING) snprintf(buf, sizeof(buf), _("--%s <string>"), opt->name); else if (opt->type == VSH_OT_DATA) - snprintf(buf, sizeof(buf), "<%s>", opt->name); + snprintf(buf, sizeof(buf), "[--%s] <string>", opt->name); fprintf(stdout, " %-15s %s\n", buf, _(opt->help)); } -- 1.7.0.1

On 06/29/2010 04:21 PM, Eric Blake wrote:
https://bugzilla.redhat.com/show_bug.cgi?id=609044 complained that 'virsh help pool-create-as' didn't document the shortcut that you can do 'virsh pool-create-as $name $type --target $target' rather than having to supply the four optional source- arguments in order to fill out the necessary positional arguments.
This one-liner changes the help output to hopefully make this more obvious:
NAME pool-create-as - create a pool from a set of args
SYNOPSIS pool-create-as <name> [--print-xml] <type> [<source-host>] [<source-path>] [<source-dev>] [<source-name>] [<target>] [--source-format <string>]
...
[--target] <string> target for underlying storage --source-format <string> format for underlying storage
If it helps in your review, note that for pool-create-as, <target> is VSH_OT_DATA while <source-format> is VSH_OT_STRING. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

https://bugzilla.redhat.com/show_bug.cgi?id=609044 complained that 'virsh help pool-create-as' didn't document the shortcut that you can do 'virsh pool-create-as $name $type --target $target' rather than having to supply the four optional source- arguments in order to fill out the necessary positional arguments. This one-liner changes the help output to hopefully make this more obvious: NAME pool-create-as - create a pool from a set of args SYNOPSIS pool-create-as <name> [--print-xml] <type> [<source-host>] [<source-path>] [<source-dev>] [<source-name>] [<target>] [--source-format <string>] DESCRIPTION Create a pool. OPTIONS [--name] <string> name of the pool --print-xml print XML document, but don't define/create [--type] <string> type of the pool [--source-host] <string> source-host for underlying storage [--source-path] <string> source path for underlying storage [--source-dev] <string> source device for underlying storage [--source-name] <string> source name for underlying storage [--target] <string> target for underlying storage --source-format <string> format for underlying storage * tools/virsh.c (vshCmddefHelp): Make it more obvious that data arguments may, but not must, be specified by option leaders. --- Changed in v2: translate the help string, now that it contains an English word and not just a %s. tools/virsh.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index f1bb295..788f274 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -9558,7 +9558,8 @@ vshCmddefHelp(vshControl *ctl, const char *cmdname) else if (opt->type == VSH_OT_STRING) snprintf(buf, sizeof(buf), _("--%s <string>"), opt->name); else if (opt->type == VSH_OT_DATA) - snprintf(buf, sizeof(buf), "<%s>", opt->name); + snprintf(buf, sizeof(buf), _("[--%s] <string>"), + opt->name); fprintf(stdout, " %-15s %s\n", buf, _(opt->help)); } -- 1.7.0.1

On 06/29/2010 07:09 PM, Eric Blake wrote:
https://bugzilla.redhat.com/show_bug.cgi?id=609044 complained that 'virsh help pool-create-as' didn't document the shortcut that you can do 'virsh pool-create-as $name $type --target $target' rather than having to supply the four optional source- arguments in order to fill out the necessary positional arguments.
This one-liner changes the help output to hopefully make this more obvious:
NAME pool-create-as - create a pool from a set of args
SYNOPSIS pool-create-as<name> [--print-xml]<type> [<source-host>] [<source-path>] [<source-dev>] [<source-name>] [<target>] [--source-format<string>]
DESCRIPTION Create a pool.
OPTIONS [--name]<string> name of the pool --print-xml print XML document, but don't define/create [--type]<string> type of the pool [--source-host]<string> source-host for underlying storage [--source-path]<string> source path for underlying storage [--source-dev]<string> source device for underlying storage [--source-name]<string> source name for underlying storage [--target]<string> target for underlying storage --source-format<string> format for underlying storage
* tools/virsh.c (vshCmddefHelp): Make it more obvious that data arguments may, but not must, be specified by option leaders. ---
Changed in v2: translate the help string, now that it contains an English word and not just a %s.
tools/virsh.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c index f1bb295..788f274 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -9558,7 +9558,8 @@ vshCmddefHelp(vshControl *ctl, const char *cmdname) else if (opt->type == VSH_OT_STRING) snprintf(buf, sizeof(buf), _("--%s<string>"), opt->name); else if (opt->type == VSH_OT_DATA) - snprintf(buf, sizeof(buf), "<%s>", opt->name); + snprintf(buf, sizeof(buf), _("[--%s]<string>"), + opt->name);
fprintf(stdout, " %-15s %s\n", buf, _(opt->help)); }
ACK.

On 06/29/2010 05:48 PM, Laine Stump wrote:
On 06/29/2010 07:09 PM, Eric Blake wrote:
https://bugzilla.redhat.com/show_bug.cgi?id=609044 complained that 'virsh help pool-create-as' didn't document the shortcut that you can do 'virsh pool-create-as $name $type --target $target' rather than having to supply the four optional source- arguments in order to fill out the necessary positional arguments.
- snprintf(buf, sizeof(buf), "<%s>", opt->name); + snprintf(buf, sizeof(buf), _("[--%s]<string>"), + opt->name);
fprintf(stdout, " %-15s %s\n", buf, _(opt->help)); }
ACK.
Thanks; pushed. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (2)
-
Eric Blake
-
Laine Stump