summaryrefslogtreecommitdiffstats
path: root/input
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-05-17 20:34:31 +0200
committerwm4 <wm4@nowhere>2018-05-24 19:56:34 +0200
commit0a7a4779a3772b26c6675910146b0d5a825d8b08 (patch)
tree7a1f2bc8b9b78ff6b1691286a23a2a7c0ff7ef21 /input
parent332907e1d7225ae39565d462aac5c45c3a5cad97 (diff)
downloadmpv-0a7a4779a3772b26c6675910146b0d5a825d8b08.tar.bz2
mpv-0a7a4779a3772b26c6675910146b0d5a825d8b08.tar.xz
input: slightly improve --input-cmdlist output
Output argument names, whether varargs are used, and indicate optional arguments correctly (instead of only half of them).
Diffstat (limited to 'input')
-rw-r--r--input/cmd.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/input/cmd.c b/input/cmd.c
index 7e50f0784b..0a6bd73931 100644
--- a/input/cmd.c
+++ b/input/cmd.c
@@ -597,12 +597,13 @@ void mp_print_cmd_list(struct mp_log *out)
const struct mp_cmd_def *def = &mp_cmds[i];
mp_info(out, "%-20.20s", def->name);
for (int j = 0; j < MP_CMD_DEF_MAX_ARGS && def->args[j].type; j++) {
- const char *type = def->args[j].type->name;
- if (def->args[j].defval)
- mp_info(out, " [%s]", type);
- else
- mp_info(out, " %s", type);
+ const struct m_option *arg = &def->args[j];
+ bool is_opt = arg->defval || (arg->flags & MP_CMD_OPT_ARG);
+ mp_info(out, " %s%s=%s%s", is_opt ? "[" : "", arg->name,
+ arg->type->name, is_opt ? "]" : "");
}
+ if (def->vararg)
+ mp_info(out, "..."); // essentially append to last argument
mp_info(out, "\n");
}
}