summaryrefslogtreecommitdiffstats
path: root/input
diff options
context:
space:
mode:
Diffstat (limited to 'input')
-rw-r--r--input/cmd_list.c2
-rw-r--r--input/cmd_list.h2
-rw-r--r--input/cmd_parse.c5
3 files changed, 6 insertions, 3 deletions
diff --git a/input/cmd_list.c b/input/cmd_list.c
index 982d4f366c..4fd5331631 100644
--- a/input/cmd_list.c
+++ b/input/cmd_list.c
@@ -122,7 +122,7 @@ const struct mp_cmd_def mp_cmds[] = {
ARG_STRING,
OARG_CHOICE(0, ({"replace", 0}, {"0", 0},
{"append", 1}, {"1", 1})),
- OPT_KEYVALUELIST(ARG(str_list), 0),
+ OPT_KEYVALUELIST(ARG(str_list), MP_CMD_OPT_ARG),
}},
{ MP_CMD_LOADLIST, "loadlist", {
ARG_STRING,
diff --git a/input/cmd_list.h b/input/cmd_list.h
index e74a21921e..9a3c25018f 100644
--- a/input/cmd_list.h
+++ b/input/cmd_list.h
@@ -24,6 +24,8 @@
#define MP_CMD_MAX_ARGS 10
+#define MP_CMD_OPT_ARG 0x1000
+
struct mp_cmd_def {
int id; // one of MP_CMD_...
const char *name; // user-visible name (as used in input.conf)
diff --git a/input/cmd_parse.c b/input/cmd_parse.c
index e2296ce215..64b23ac05f 100644
--- a/input/cmd_parse.c
+++ b/input/cmd_parse.c
@@ -199,10 +199,11 @@ static struct mp_cmd *parse_cmd(struct parse_ctx *ctx, int def_flags)
if (is_vararg)
continue;
// Skip optional arguments
- if (opt->defval) {
+ if (opt->defval || (opt->flags & MP_CMD_OPT_ARG)) {
struct mp_cmd_arg *cmdarg = &cmd->args[cmd->nargs];
cmdarg->type = opt;
- m_option_copy(opt, &cmdarg->v, opt->defval);
+ if (opt->defval)
+ m_option_copy(opt, &cmdarg->v, opt->defval);
cmd->nargs++;
continue;
}