@@ -70,11 +70,13 @@
#
# @event: a QMP event
#
+# @option: a command line option (since 2.11)
+#
# Since: 2.5
##
{ 'enum': 'SchemaMetaType',
'data': [ 'builtin', 'enum', 'array', 'object', 'alternate',
- 'command', 'event' ] }
+ 'command', 'event', 'option' ] }
##
# @SchemaInfo:
@@ -103,7 +105,8 @@
'object': 'SchemaInfoObject',
'alternate': 'SchemaInfoAlternate',
'command': 'SchemaInfoCommand',
- 'event': 'SchemaInfoEvent' } }
+ 'event': 'SchemaInfoEvent',
+ 'option': 'SchemaInfoOption' } }
##
# @SchemaInfoBuiltin:
@@ -278,3 +281,18 @@
##
{ 'struct': 'SchemaInfoEvent',
'data': { 'arg-type': 'str' } }
+
+##
+# @SchemaInfoOption:
+#
+# Additional SchemaInfo members for meta-type 'option'.
+#
+# @arg-type: the name of the object type that provides the option's
+# parameters.
+#
+# @short: the option character, if any.
+#
+# Since: 2.11
+##
+{ 'struct': 'SchemaInfoOption',
+ 'data': { 'arg-type': 'str', '*short': 'str' } }
@@ -108,7 +108,7 @@ const char %(c_name)s[] = %(c_string)s;
return self._name(typ.name)
def _gen_json(self, name, mtype, obj):
- if mtype not in ('command', 'event', 'builtin', 'array'):
+ if mtype not in ('command', 'event', 'option', 'builtin', 'array'):
name = self._name(name)
obj['name'] = name
obj['meta-type'] = mtype
@@ -161,6 +161,14 @@ const char %(c_name)s[] = %(c_string)s;
arg_type = arg_type or self._schema.the_empty_object_type
self._gen_json(name, 'event', {'arg-type': self._use_type(arg_type)})
+ def visit_option(self, name, info, arg_type, short, implied_key,
+ boxed, help_):
+ arg_type = arg_type or self._schema.the_empty_object_type
+ obj = {'arg-type': self._use_type(arg_type)}
+ if short:
+ obj['short'] = short
+ self._gen_json(name, 'option', obj)
+
parser = common_argument_parser()
# Debugging aid: unmask QAPI schema's type names
# We normally mask them, because they're not QMP wire ABI
Make query-qmp-schema describe command line options in addition to QMP commands and events. Simple, but it pushes query-qmp-schema beyond QMP. Perhaps options introspection should be separate. Perhaps not for the same reason QMP and command line are defined in the same schema: they share many types. Signed-off-by: Markus Armbruster <armbru@redhat.com> --- qapi/introspect.json | 22 ++++++++++++++++++++-- scripts/qapi-introspect.py | 10 +++++++++- 2 files changed, 29 insertions(+), 3 deletions(-)