@@ -41,6 +41,7 @@ typedef struct QEMUOption {
const char *name;
int flags;
int index;
+ const char *help;
uint32_t arch_mask;
} QEMUOption;
@@ -9,7 +9,8 @@
#include "qemu-options.h"
const QEMUOption qemu_options[] = {
- { "h", 0, QEMU_OPTION_h, QEMU_ARCH_ALL },
+ { "h", 0, QEMU_OPTION_h, "-h or -help display this help and exit\n",
+ QEMU_ARCH_ALL },
#define QEMU_OPTIONS_GENERATE_OPTIONS
#include "qemu-options-wrapper.h"
{ NULL },
@@ -147,6 +148,7 @@ CommandLineOptionInfoList *qmp_query_command_line_options(bool has_
CommandLineOptionInfo *info;
QemuOptsList *list;
int i;
+ const char *p;
for (i = 0; qemu_options[i].name; i++) {
if (!has_option || !strcmp(option, qemu_options[i].name)) {
@@ -161,8 +163,23 @@ CommandLineOptionInfoList *qmp_query_command_line_options(bool has
}
if (!info->parameters) {
- info->has_unspecified_parameters = true;
- info->unspecified_parameters = qemu_options[i].flags & HAS_ARG;
+ info->has_argument_state = true;
+
+ if (!qemu_options[i].flags & HAS_ARG) {
+ info->argument_state = ARGUMENT_STATE_TYPE_NO_ARGUMENT;
+ } else {
+ info->argument_state =
+ ARGUMENT_STATE_TYPE_NO_PARAMETER_ARGUMENT;
+ }
+
+ p = qemu_options[i].help;
+ while (*p) {
+ if (*p != ' ' && *(p + 1) == '[') {
^^^^^
I know the string matching in while loop is too crude ;-) we can make it strict.
+ info->argument_state =
+ ARGUMENT_STATE_TYPE_UNSPECIFIED_PARAMETERS_ARGUMENT;
+ }
+ p += 1;