options: deprecate -del for list options

I never liked that these used integer indexes. -remove should have
existed from the start. This deprecation is yet another empty threat,
though.
This commit is contained in:
wm4 2019-12-18 06:57:24 +01:00
parent 9b9307ea9f
commit 5f74ed5828
5 changed files with 14 additions and 6 deletions

View File

@ -75,6 +75,8 @@ Interface changes
options (for example --script-opts-add). This was actually always
deprecated, like with other list options, but the option parser did not
print a warning in this particular case.
- deprecate -del for list options (use -remove instead, which is by content
instead of by integer index)
--- mpv 0.30.0 ---
- add `--d3d11-output-format` to enable explicit selection of a D3D11
swap chain format.

View File

@ -752,7 +752,7 @@ Input Commands that are Possibly Subject to Change
cases, the second parameter is a comma separated list of filter names
or integer indexes. ``0`` would denote the first filter. Negative
indexes start from the last filter, and ``-1`` denotes the last
filter.
filter. Deprecated.
<clr>
Remove all filters. Note that like the other sub-commands, this does

View File

@ -497,7 +497,7 @@ Suffix Meaning
-pre Prepend 1 or more items (same syntax as -set)
-clr Clear the option (remove all items)
-remove Delete item if present (does not interpret escapes)
-del Delete 1 or more items by integer index
-del Delete 1 or more items by integer index (deprecated)
-toggle Append an item, or remove if if it already exists (no escapes)
============= ===============================================
@ -541,7 +541,7 @@ Suffix Meaning
-pre Prepend 1 or more filters (same syntax as -set)
-clr Clear the option (remove all filters)
-remove Delete filter if present
-del Delete 1 or more filters by integer index or filter label
-del Delete 1 or more filters by integer index or filter label (deprecated)
-toggle Append a filter, or remove if if it already exists
-help Pseudo operation that prints a help text to the terminal
============= ===============================================

View File

@ -102,7 +102,8 @@ filter list.
with ``@``). Matching of filters works as follows: if either of the compared
filters has a label set, only the labels are compared. If none of the
filters have a label, the filter name, arguments, and argument order are
compared.
compared. (Passing multiple filters is currently still possible, but
deprecated.)
``-vf-toggle=filter``
Add the given filter to the list if it was not present yet, or remove it
@ -112,8 +113,7 @@ filter list.
``--vf-del=filter``
Sort of like ``--vf-remove``, but also accepts an index number. Index
numbers start at 0, negative numbers address the end of the list (-1 is the
last). (Passing multiple filters is currently still possible, but
deprecated.)
last). Deprecated.
``--vf-clr``
Completely empties the filter list.

View File

@ -1404,6 +1404,9 @@ static int parse_str_list_impl(struct mp_log *log, const m_option_t *opt,
op = OP_PRE;
} else if (bstr_endswith0(name, "-del")) {
op = OP_DEL;
mp_warn(log, "Option %.*s: -del is deprecated! "
"Use -remove (removes by content instead of by index).\n",
BSTR_P(name));
} else if (bstr_endswith0(name, "-clr")) {
op = OP_CLR;
} else if (bstr_endswith0(name, "-set")) {
@ -3278,6 +3281,9 @@ static int parse_obj_settings_list(struct mp_log *log, const m_option_t *opt,
op = OP_PRE;
} else if (bstr_endswith0(name, "-del")) {
op = OP_DEL;
mp_warn(log, "Option %.*s: -del is deprecated! "
"Use -remove (removes by content instead of by index).\n",
BSTR_P(name));
} else if (bstr_endswith0(name, "-remove")) {
op = OP_REMOVE;
} else if (bstr_endswith0(name, "-clr")) {