qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <lvivier@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org, marcandre.lureau@gmail.com
Cc: armbru@redhat.com
Subject: [Qemu-devel] [PATCH v3 2/2] -help lists only -help-* commands
Date: Fri, 28 Aug 2015 00:22:54 +0200	[thread overview]
Message-ID: <1440714174-13261-2-git-send-email-lvivier@redhat.com> (raw)
In-Reply-To: <1440714174-13261-1-git-send-email-lvivier@redhat.com>

A slight change of behavior:

    -help-all displays all helps (like -help/-h before)
    -help/-h lists only the available help commands

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
v3: add this patch to add an help section, -help displays only this section
 qemu-options.hx | 29 +++++++++++++++++++++++++----
 vl.c            | 12 +++++++++++-
 2 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/qemu-options.hx b/qemu-options.hx
index 49b78df..f89d4e2 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -6,21 +6,29 @@ HXCOMM construct option structures, enums and help message for specified
 HXCOMM architectures.
 HXCOMM HXCOMM can be used for comments, discarded from both texi and C
 
-#if defined(QEMU_HELP_SELECT_STANDARD) || !defined(QEMU_HELP_SELECT)
-#undef QEMU_HELP_SELECT_STANDARD
-DEFHEADING(Standard options:)
+#if defined(QEMU_HELP_SELECT_HELP) || !defined(QEMU_HELP_SELECT)
+#undef QEMU_HELP_SELECT_HELP
+DEFHEADING(Help/version options:)
 STEXI
 @table @option
 ETEXI
 
 DEF("help", 0, QEMU_OPTION_h,
-    "-h or -help     display all help options and exit\n", QEMU_ARCH_ALL)
+    "-h or -help     list all help options\n", QEMU_ARCH_ALL)
 STEXI
 @item -h
 @findex -h
 Display all help options and exit
 ETEXI
 
+DEF("help-all", 0, QEMU_OPTION_h_all,
+    "-help-all       display all help options\n", QEMU_ARCH_ALL)
+STEXI
+@item -help-all
+@findex -help-all
+Display all help options and exit
+ETEXI
+
 DEF("help-standard", 0, QEMU_OPTION_h_standard,
     "-help-standard  display standard options\n", QEMU_ARCH_ALL)
 STEXI
@@ -133,6 +141,19 @@ STEXI
 Display version information and exit
 ETEXI
 
+STEXI
+@end table
+ETEXI
+DEFHEADING()
+#endif
+
+#if defined(QEMU_HELP_SELECT_STANDARD) || !defined(QEMU_HELP_SELECT)
+#undef QEMU_HELP_SELECT_STANDARD
+DEFHEADING(Standard options:)
+STEXI
+@table @option
+ETEXI
+
 DEF("machine", HAS_ARG, QEMU_OPTION_machine, \
     "-machine [type=]name[,prop[=value][,...]]\n"
     "                selects emulated machine ('-machine help' for list)\n"
diff --git a/vl.c b/vl.c
index e581dd2..85d02cb 100644
--- a/vl.c
+++ b/vl.c
@@ -1911,7 +1911,7 @@ static void version(void)
     printf("QEMU emulator version " QEMU_VERSION QEMU_PKGVERSION ", Copyright (c) 2003-2008 Fabrice Bellard\n");
 }
 
-static void help(int exitcode)
+static void help_all(int exitcode)
 {
     version();
     printf("usage: %s [options] [disk_image]\n\n"
@@ -1932,6 +1932,13 @@ static void help(int exitcode)
 }
 
 #define QEMU_HELP_SELECT
+static void help(int exitcode)
+{
+#define QEMU_HELP_SELECT_HELP
+#define QEMU_OPTIONS_GENERATE_HELP
+#include "qemu-options-wrapper.h"
+    exit(exitcode);
+}
 static void help_standard(int exitcode)
 {
 #define QEMU_HELP_SELECT_STANDARD
@@ -3413,6 +3420,9 @@ int main(int argc, char **argv, char **envp)
             case QEMU_OPTION_h:
                 help(0);
                 break;
+            case QEMU_OPTION_h_all:
+                help_all(0);
+                break;
             case QEMU_OPTION_h_standard:
                 help_standard(0);
                 break;
-- 
2.1.0

  reply	other threads:[~2015-08-27 22:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-27 15:20 [Qemu-devel] [PATCH, RFC] Use help sub-sections to create sub-help options Laurent Vivier
2015-08-27 15:44 ` Marc-André Lureau
2015-08-27 15:50   ` Laurent Vivier
2015-08-27 17:07   ` [Qemu-devel] [PATCH, RFC v2] " Laurent Vivier
2015-08-27 21:37     ` Marc-André Lureau
2015-08-27 22:22       ` [Qemu-devel] [PATCH v3 1/2] " Laurent Vivier
2015-08-27 22:22         ` Laurent Vivier [this message]
2015-09-02 17:06           ` [Qemu-devel] [PATCH v3 2/2] -help lists only -help-* commands Eric Blake
2015-08-27 22:43         ` [Qemu-devel] [PATCH v3 1/2] Use help sub-sections to create sub-help options Eric Blake
2015-09-02 16:45         ` Laurent Vivier
2015-09-02 17:02         ` Eric Blake

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=1440714174-13261-2-git-send-email-lvivier@redhat.com \
    --to=lvivier@redhat.com \
    --cc=armbru@redhat.com \
    --cc=marcandre.lureau@gmail.com \
    --cc=pbonzini@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).