m_option: add -clr to keyvalue list options

Seems to have been omitted by mistake and nobody ever noticed.
This commit is contained in:
Dudemanguy committed 2025-01-29 20:45:13 +00:00
1 parent d2c409c56b
commit 4c3eb16a47
3 files changed
+7

No files matched your search

+1
View File
@@ -1,2 +1,3 @@
undeprecate list option suffixes that work with multiple items
add `-del` to string list and keyvalue list options
add `-clr` to keyvalue list options
+1
View File
@@ -676,6 +676,7 @@ Suffix Meaning
-set Set a list of items (using ``,`` as separator)
-append Append a single item (escapes for the key, no escapes for the value)
-add Append 1 or more items (same syntax as -set)
-clr Clear the option (remove all items)
-del Delete 1 or more keys if present (same syntax as -set)
-remove Delete item by key if present (does not interpret escapes)
============= ===============================================
+5
View File
@@ -1718,6 +1718,10 @@ static int parse_keyvalue_list(struct mp_log *log, const m_option_t *opt,
append = true;
} else if (bstr_endswith0(name, "-append")) {
append = full_value = true;
} else if (bstr_endswith0(name, "-clr")) {
if (dst)
free_str_list(dst);
return 0;
} else if (op == OP_DEL || op == OP_REMOVE) {
int n = 0;
char **res = separate_input_param(opt, param, &n, op);
@@ -1861,6 +1865,7 @@ const m_option_type_t m_option_type_keyvalue_list = {
.actions = (const struct m_option_action[]){
{"add"},
{"append"},
{"clr", M_OPT_TYPE_OPTIONAL_PARAM},
{"del"},
{"set"},
{"remove"},