summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-12-24 16:03:16 +0100
committerwm4 <wm4@nowhere>2019-12-24 16:03:16 +0100
commit029bb593e7726b75758122ed559b33b7940bd2c7 (patch)
treef0362fdefeaca628b243663c59cdd1eb5ee08200
parentb6d7d246fe30b7e2a8ace6a185af8071b354b551 (diff)
downloadmpv-029bb593e7726b75758122ed559b33b7940bd2c7.tar.bz2
mpv-029bb593e7726b75758122ed559b33b7940bd2c7.tar.xz
command: extend command-list output
Add some very basic information about arguments.
-rw-r--r--player/command.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index a230ad460c..a6ceaf039a 100644
--- a/player/command.c
+++ b/player/command.c
@@ -3242,6 +3242,20 @@ static int mp_property_commands(void *ctx, struct m_property *prop,
struct mpv_node *entry = node_array_add(root, MPV_FORMAT_NODE_MAP);
node_map_add_string(entry, "name", cmd->name);
+
+ struct mpv_node *args =
+ node_map_add(entry, "args", MPV_FORMAT_NODE_ARRAY);
+ for (int i = 0; i < MP_CMD_DEF_MAX_ARGS; i++) {
+ const struct m_option *a = &cmd->args[i];
+ if (!a->type)
+ break;
+ struct mpv_node *ae = node_array_add(args, MPV_FORMAT_NODE_MAP);
+ node_map_add_string(ae, "name", a->name);
+ node_map_add_string(ae, "type", a->type->name);
+ node_map_add_flag(ae, "optional", a->flags & MP_CMD_OPT_ARG);
+ }
+
+ node_map_add_flag(entry, "vararg", cmd->vararg);
}
return M_PROPERTY_OK;