From 153d4927ab343f3102dee797528aa83f9d660795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Mon, 21 Oct 2024 21:32:08 +0200 Subject: [PATCH] options: add --script-opt alias for --script-opts-append --- DOCS/interface-changes/script-opt.txt | 1 + DOCS/man/options.rst | 7 +++++-- DOCS/man/stats.rst | 6 +++--- options/options.c | 1 + 4 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 DOCS/interface-changes/script-opt.txt diff --git a/DOCS/interface-changes/script-opt.txt b/DOCS/interface-changes/script-opt.txt new file mode 100644 index 0000000000..8c20e65471 --- /dev/null +++ b/DOCS/interface-changes/script-opt.txt @@ -0,0 +1 @@ +add `--script-opt` alias for `--script-opts-append` diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 13218522a2..add7073517 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -828,12 +828,15 @@ Program Behavior ``--scripts`` is a path list option. See `List Options`_ for details. -``--script-opts=key1=value1,key2=value2,...`` +``--script-opt=``, ``--script-opts=key1=value1,key2=value2,...`` Set options for scripts. A script can query an option by key. If an option is used and what semantics the option value has depends entirely on the loaded scripts. Values not claimed by any scripts are ignored. - This is a key/value list option. See `List Options`_ for details. + Each use of the ``--script-opt`` option will add another option to the + internal list, while ``--script-opts`` takes a list of options at once, + and overwrites the internal list with it. The latter is a key/value list + option. See `List Options`_ for details. ``--merge-files`` Pretend that all files passed to mpv are concatenated into a single, big diff --git a/DOCS/man/stats.rst b/DOCS/man/stats.rst index 1f3fee8ee2..a306b430a1 100644 --- a/DOCS/man/stats.rst +++ b/DOCS/man/stats.rst @@ -251,11 +251,11 @@ The keys are grouped automatically using a simple analysis of the command string, and one should not expect documentation-level grouping accuracy, however, it should still be reasonably useful. -Using ``--idle --script-opts-append=stats-bindlist=yes`` will print the list to +Using ``--idle --script-opt=stats-bindlist=yes`` will print the list to the terminal and quit immediately. Long lines are clipped to the terminal width -unless this is disabled with ``--script-opts-append=stats-term_clip=no``. Escape +unless this is disabled with ``--script-opt=stats-term_clip=no``. Escape sequences can be disabled by adding ``-`` before ``yes``, i.e. -``--script-opts-append=stats-bindlist=-yes``. +``--script-opt=stats-bindlist=-yes``. Like with ``--input-test``, the list includes bindings from ``input.conf`` and from user scripts. Use ``--no-config`` to list only built-in bindings. diff --git a/options/options.c b/options/options.c index 4954cbe36b..3b10a45327 100644 --- a/options/options.c +++ b/options/options.c @@ -557,6 +557,7 @@ static const m_option_t mp_opts[] = { {"scripts", OPT_PATHLIST(script_files), .flags = M_OPT_FILE}, {"script", OPT_CLI_ALIAS("scripts-append")}, {"script-opts", OPT_KEYVALUELIST(script_opts)}, + {"script-opt", OPT_CLI_ALIAS("script-opts-append")}, {"load-scripts", OPT_BOOL(auto_load_scripts)}, #endif #if HAVE_JAVASCRIPT