summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/input.rst2
-rw-r--r--input/cmd.c11
2 files changed, 7 insertions, 6 deletions
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index d2c92d7476..b577b688d0 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -138,7 +138,7 @@ Like with array commands, quoting and escaping is inherently not needed in the
normal case.
The name of each command is defined in each command description in the
-`List of Input Commands`_.
+`List of Input Commands`_. ``--input-cmdlist`` also lists them.
Some commands do not support named arguments (e.g. ``run`` command). You need
to use APIs that pass arguments as arrays.
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");
}
}