qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 1/2] qemu-option: add help fallback to print the lis


From: Marc-André Lureau
Subject: [Qemu-devel] [PATCH 1/2] qemu-option: add help fallback to print the list of options
Date: Wed, 15 Aug 2018 21:50:50 +0200

QDev options accept '?' or 'help' in the list of parameters, which is
really handy to list the available options.

Unfortunately, this isn't built in QemuOpts. qemu_opts_parse_noisily()
seems to be the common path for command line options, so place a
fallback to check for '?' and print help listing available options.

This is very handy, for example with qemu "-spice ?".

Signed-off-by: Marc-André Lureau <address@hidden>
---
 util/qemu-option.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/util/qemu-option.c b/util/qemu-option.c
index 01886efe90..8839ee6523 100644
--- a/util/qemu-option.c
+++ b/util/qemu-option.c
@@ -889,7 +889,12 @@ QemuOpts *qemu_opts_parse_noisily(QemuOptsList *list, 
const char *params,
 
     opts = opts_parse(list, params, permit_abbrev, false, &err);
     if (err) {
-        error_report_err(err);
+        if (has_help_option(params)) {
+            qemu_opts_print_help(list);
+            error_free(err);
+        } else {
+            error_report_err(err);
+        }
     }
     return opts;
 }
-- 
2.18.0.547.g1d89318c48




reply via email to

[Prev in Thread] Current Thread [Next in Thread]