qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 15/19] Expand query-argv to include help string


From: Daniel P. Berrange
Subject: [Qemu-devel] [PATCH 15/19] Expand query-argv to include help string
Date: Mon, 7 Jun 2010 15:42:28 +0100

This expands the query-argv data format to include the help
string for each argument. This is not really very desirable
since the help strings are not in a predictable format for apps
to use. Ideally the full structured details about each argument
parameter would be included instead. This makes the data format
look like

    [
        {
            "name": "help",
            "help": "-h or -help     display this help and exit\n",
        },
        {
            "name": "M",
            "help": "-M machine      select emulated machine (-M ? for list)\n",
            "parameters": [
            ]
        },
    ]

Signed-off-by: Daniel P. Berrange <address@hidden>
---
 vl.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/vl.c b/vl.c
index a76c673..35d2b51 100644
--- a/vl.c
+++ b/vl.c
@@ -2030,14 +2030,14 @@ void do_info_argv(Monitor *mon, QObject **data)
        const char *help;
     } options_help[] = {
 #define DEF(option, opt_arg, opt_enum, opt_help, arch_mask)     \
-        { option, opt_arg },
+        { option, opt_arg, opt_help },
 #define DEFHEADING(text)
 #define HAS_ARG 1
 #include "qemu-options.h"
 #undef DEF
 #undef DEFHEADING
 #undef HAS_ARG
-       { NULL, 0 },
+       { NULL, 0, NULL },
     };
     int i;
 
@@ -2046,14 +2046,15 @@ void do_info_argv(Monitor *mon, QObject **data)
 
        if (options_help[i].has_arg) {
            /* XXX actually fill in the parameter details */
-           opt = qobject_from_jsonf("{ 'name': %s, 'parameters': [] }",
-                                    options_help[i].name);
+           opt = qobject_from_jsonf("{ 'name': %s, 'help': %s, 'parameters': 
[] }",
+                                    options_help[i].name,
+                                    options_help[i].help);
        } else {
-           opt = qobject_from_jsonf("{ 'name': %s }",
-                                    options_help[i].name);
+           opt = qobject_from_jsonf("{ 'name': %s, 'help': %s }",
+                                    options_help[i].name,
+                                    options_help[i].help);
        }
 
-
        qlist_append_obj(args, opt);
     }
 
-- 
1.6.6.1




reply via email to

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