From patchwork Thu Aug 27 22:22:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 511676 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3A3A714012C for ; Fri, 28 Aug 2015 08:23:22 +1000 (AEST) Received: from localhost ([::1]:44940 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZV5Zo-0000b2-2C for incoming@patchwork.ozlabs.org; Thu, 27 Aug 2015 18:23:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58886) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZV5ZY-0000JA-1a for qemu-devel@nongnu.org; Thu, 27 Aug 2015 18:23:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZV5ZT-0004mu-Vj for qemu-devel@nongnu.org; Thu, 27 Aug 2015 18:23:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54668) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZV5ZT-0004mj-OM for qemu-devel@nongnu.org; Thu, 27 Aug 2015 18:22:59 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 3FFEF8EA3C; Thu, 27 Aug 2015 22:22:59 +0000 (UTC) Received: from thinkpad.redhat.com (vpn1-7-222.ams2.redhat.com [10.36.7.222]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7RMMtDE020597; Thu, 27 Aug 2015 18:22:57 -0400 From: Laurent Vivier To: Paolo Bonzini , qemu-devel@nongnu.org, marcandre.lureau@gmail.com Date: Fri, 28 Aug 2015 00:22:54 +0200 Message-Id: <1440714174-13261-2-git-send-email-lvivier@redhat.com> In-Reply-To: <1440714174-13261-1-git-send-email-lvivier@redhat.com> References: <1440714174-13261-1-git-send-email-lvivier@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: armbru@redhat.com Subject: [Qemu-devel] [PATCH v3 2/2] -help lists only -help-* commands X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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;