All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Laurent Vivier <lvivier@redhat.com>,
	qemu-devel@nongnu.org, marcandre.lureau@gmail.com
Subject: Re: [Qemu-devel] [PATCH v4 3/3] Use help sub-sections to create sub-help options
Date: Fri, 4 Sep 2015 14:13:07 -0600	[thread overview]
Message-ID: <55E9FB53.7070503@redhat.com> (raw)
In-Reply-To: <1441395005-14907-4-git-send-email-lvivier@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 3808 bytes --]

On 09/04/2015 01:30 PM, Laurent Vivier wrote:
> As '-help' output is 400 lines long it is not easy
> to find information, but generally we know from
> which area we want the information.
> 
> As sections already exist in the help description,
> add some options to only display the wanted section.
> 
> '-help' now can take an optional parameter, which is
> a comma separated list of sections to display:
> 
>     standard  display standard options
>     block     display block options
>     usb       display usb options
>     display   display display options
>     machine   display machine options
>     network   display network options
>     character display character options
>     url       display url options
>     bt        display bt options
>     tpm       display tpm options
>     kernel    display kernel options
>     expert    display expert options
>     object    display object options
> 
> '-help' without option displays all help sections.

No, that's not quite what I suggested.

-help without options should display AT MOST one screen-ful: start with
the usage: header (I don't know if version information has to stay,
since it is also present in --version, but it doesn't hurt as it is only
one line), and conclude with details about how to get more help.

Or, based on your patch, it should be something like:

> $ qemu-kvm -help
> QEMU emulator version 2.4.50, Copyright (c) 2003-2008 Fabrice Bellard
> usage: qemu-system-x86_64 [options] [disk_image]
> 
> 'disk_image' is a raw hard disk image for IDE hard disk 0
> 
> Help/version options:
> -h|-help [section][,...]
> list help options.
> You can provide the list of sections to display.
> available sections are:
> standard,block,usb,display,machine,network,character,
> url,bt,tpm,kernel,expert,object
> -version display version information and exit
> 
> For full details, try -help=all.

--help=help (or --help=sections, or whatever you name it) could be a
synonym for bare --help.

--help=all should display ALL sections, without having to spell out each
section by name.  And the LAST thing displayed should be the --help=help
section (so I don't have to invoke a pager to see how to limit the
output to the subsections I'm interested in).

--help=LIST for any other comma-separated LIST should produce those
particular sections.  I don't care if you reorder the sections (that is,
if --help=block,usb and --help=usb,block produce the same output, or if
they produce sections in swapped order, is up to you).

> 
>     $ x86_64-softmmu/qemu-system-x86_64 -help kernel,usb

Also, I think you need '=' not ' ' between -help and the list; but other
than that,

>     QEMU emulator version 2.4.50, Copyright (c) 2003-2008 Fabrice Bellard
>     usage: qemu-system-x86_64 [options] [disk_image]
> 
>     'disk_image' is a raw hard disk image for IDE hard disk 0
> 
>     Linux/Multiboot boot specific:
>     -kernel bzImage use 'bzImage' as kernel image
>     -append cmdline use 'cmdline' as kernel command line
>     -initrd file    use 'file' as initial ram disk
>     -dtb    file    use 'file' as device tree image
> 
>     USB options:
>     -usb            enable the USB driver (will be the default soon)
>     -usbdevice name add the host or guest USB device 'name'

this is indeed a nice example of how limiting to subsections can be useful.

> 
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
>  qemu-options.hx | 120 +++++++++++++++++++++++++++++++++++++++---
>  vl.c            | 160 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
>  2 files changed, 265 insertions(+), 15 deletions(-)

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

      reply	other threads:[~2015-09-04 20:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-04 19:30 [Qemu-devel] [PATCH v4 0/3] Improve -help Laurent Vivier
2015-09-04 19:30 ` [Qemu-devel] [PATCH v4 1/3] vl: Add a flags to define parameters with optional arguments Laurent Vivier
2015-09-04 19:42   ` Eric Blake
2015-09-04 19:52     ` Eric Blake
2015-09-04 19:55     ` Stefan Weil
2015-09-04 20:06       ` Eric Blake
2015-09-04 19:30 ` [Qemu-trivial] [PATCH v4 2/3] help: fix typo Laurent Vivier
2015-09-04 19:30   ` [Qemu-devel] " Laurent Vivier
2015-09-04 19:34   ` [Qemu-trivial] " Eric Blake
2015-09-04 19:34     ` [Qemu-devel] " Eric Blake
2015-09-06 11:06   ` [Qemu-trivial] " Michael Tokarev
2015-09-06 11:06     ` [Qemu-devel] " Michael Tokarev
2015-09-04 19:30 ` [Qemu-devel] [PATCH v4 3/3] Use help sub-sections to create sub-help options Laurent Vivier
2015-09-04 20:13   ` Eric Blake [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55E9FB53.7070503@redhat.com \
    --to=eblake@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=marcandre.lureau@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.