diff options
author | wm4 <wm4@nowhere> | 2019-12-24 16:03:16 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-12-24 16:03:16 +0100 |
commit | 029bb593e7726b75758122ed559b33b7940bd2c7 (patch) | |
tree | f0362fdefeaca628b243663c59cdd1eb5ee08200 /player/command.c | |
parent | b6d7d246fe30b7e2a8ace6a185af8071b354b551 (diff) | |
download | mpv-029bb593e7726b75758122ed559b33b7940bd2c7.tar.bz2 mpv-029bb593e7726b75758122ed559b33b7940bd2c7.tar.xz |
command: extend command-list output
Add some very basic information about arguments.
Diffstat (limited to 'player/command.c')
-rw-r--r-- | player/command.c | 14 |
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; |