From 5f74ed58286a1339412554932f31844ec1b64280 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 18 Dec 2019 06:57:24 +0100 Subject: 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. --- DOCS/interface-changes.rst | 2 ++ DOCS/man/input.rst | 2 +- DOCS/man/mpv.rst | 4 ++-- DOCS/man/vf.rst | 6 +++--- options/m_option.c | 6 ++++++ 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index 8926d63f08..317646ce3a 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -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. diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst index 8f8a5681cc..0f6ec9430e 100644 --- a/DOCS/man/input.rst +++ b/DOCS/man/input.rst @@ -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. Remove all filters. Note that like the other sub-commands, this does diff --git a/DOCS/man/mpv.rst b/DOCS/man/mpv.rst index a96dd1149e..7ae4261605 100644 --- a/DOCS/man/mpv.rst +++ b/DOCS/man/mpv.rst @@ -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 ============= =============================================== diff --git a/DOCS/man/vf.rst b/DOCS/man/vf.rst index 7f0b0f9bc9..463ce07cbc 100644 --- a/DOCS/man/vf.rst +++ b/DOCS/man/vf.rst @@ -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. diff --git a/options/m_option.c b/options/m_option.c index 874b22f6f4..19802f9fc4 100644 --- a/options/m_option.c +++ b/options/m_option.c @@ -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")) { -- cgit v1.2.3