History

m_option: add -clr to keyvalue list options

Seems to have been omitted by mistake and nobody ever noticed.

Dudemanguy committed 1 year ago

Commit 4c3eb161 parent d2c409c3 files · +7 −0Browse files

Unified · Split

3 files
  1. DOCS/interface-changes/list-option.txt +1 −0
  2. DOCS/man/mpv.rst +1 −0
  3. options/m_option.c +5 −0
DOCS/interface-changes/list-option.txt+1−0
@@ -1,2 +1,3 @@
1undeprecate list option suffixes that work with multiple items1undeprecate list option suffixes that work with multiple items
2add `-del` to string list and keyvalue list options2add `-del` to string list and keyvalue list options
3add `-clr` to keyvalue list options
DOCS/man/mpv.rst+1−0
@@ -676,6 +676,7 @@ Suffix Meaning · 675 unmodified lines
676-set Set a list of items (using ``,`` as separator)676-set Set a list of items (using ``,`` as separator)
677-append Append a single item (escapes for the key, no escapes for the value)677-append Append a single item (escapes for the key, no escapes for the value)
678-add Append 1 or more items (same syntax as -set)678-add Append 1 or more items (same syntax as -set)
679-clr Clear the option (remove all items)
679-del Delete 1 or more keys if present (same syntax as -set)680-del Delete 1 or more keys if present (same syntax as -set)
680-remove Delete item by key if present (does not interpret escapes)681-remove Delete item by key if present (does not interpret escapes)
681============= ===============================================682============= ===============================================
options/m_option.c+5−0
@@ -1718,6 +1718,10 @@ static int parse_keyvalue_list(struct mp_log *log, const m_option_t *opt, · 1717 unmodified lines
1718 append = true;1718 append = true;
1719 } else if (bstr_endswith0(name, "-append")) {1719 } else if (bstr_endswith0(name, "-append")) {
1720 append = full_value = true;1720 append = full_value = true;
1721 } else if (bstr_endswith0(name, "-clr")) {
1722 if (dst)
1723 free_str_list(dst);
1724 return 0;
1721 } else if (op == OP_DEL || op == OP_REMOVE) {1725 } else if (op == OP_DEL || op == OP_REMOVE) {
1722 int n = 0;1726 int n = 0;
1723 char **res = separate_input_param(opt, param, &n, op);1727 char **res = separate_input_param(opt, param, &n, op);
@@ -1861,6 +1865,7 @@ const m_option_type_t m_option_type_keyvalue_list = { · 137 unmodified lines
1861 .actions = (const struct m_option_action[]){1865 .actions = (const struct m_option_action[]){
1862 {"add"},1866 {"add"},
1863 {"append"},1867 {"append"},
1868 {"clr", M_OPT_TYPE_OPTIONAL_PARAM},
1864 {"del"},1869 {"del"},
1865 {"set"},1870 {"set"},
1866 {"remove"},1871 {"remove"},

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t