diff options
author | wm4 <wm4@nowhere> | 2013-09-20 22:53:06 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-09-20 23:09:43 +0200 |
commit | f988c6300344492c4a8d8db11c47a4ebed4e858b (patch) | |
tree | c4cda2ccf8f4861cc633d9a0fdef84f7af0b6080 /DOCS/man/en | |
parent | ab706f996908bf7de3774f36af70ed485e1a0eb9 (diff) | |
download | mpv-f988c6300344492c4a8d8db11c47a4ebed4e858b.tar.bz2 mpv-f988c6300344492c4a8d8db11c47a4ebed4e858b.tar.xz |
m_property: add a way to switch on property values in property expansion
Allows for example: --status-msg='${?pause==yes:(Paused) } ...' to
emulate the normal terminal status line. It's useful in other situations
too.
I'm a bit worried about extending this mini-DSL, and sure hope nobody
will implement a generic formula evaluator at some point in the future.
But for now we're probably safe.
Diffstat (limited to 'DOCS/man/en')
-rw-r--r-- | DOCS/man/en/input.rst | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/DOCS/man/en/input.rst b/DOCS/man/en/input.rst index e40457e099..362e8a4cf8 100644 --- a/DOCS/man/en/input.rst +++ b/DOCS/man/en/input.rst @@ -509,15 +509,27 @@ The following expansions are supported: fails, expand to an error string. (Use ``${NAME:}`` with a trailing ``:`` to expand to an empty string instead.) If ``NAME`` is prefixed with ``=``, expand to the raw value of the property - (see below). + (see section below). ``${NAME:STR}`` Expands to the value of the property ``NAME``, or ``STR`` if the property cannot be retrieved. ``STR`` is expanded recursively. +``${?NAME:STR}`` + Expands to ``STR`` (recursively) if the property ``NAME`` is available. ``${!NAME:STR}`` Expands to ``STR`` (recursively) if the property ``NAME`` cannot be retrieved. -``${?NAME:STR}`` - Expands to ``STR`` (recursively) if the property ``NAME`` is available. +``${?NAME==VALUE:STR}`` + Expands to ``STR`` (recursively) if the property ``NAME`` expands to a + string equal to ``VALUE``. You can prefix ``NAME`` with ``=`` in order to + compare the raw value of a property (see section below). If the property + is unavailable, or other errors happen when retrieving it, the value is + never considered equal. + Note that ``VALUE`` can't contain any of the characters ``:`` or ``}``. + Also, it is possible that escaping with ``"`` or ``%`` might be added in + the future, should the need arise. +``${!NAME==VALUE:STR}`` + Same as with the ``?`` variant, but ``STR`` is expanded if the value is + not equal. (Using the same semantics as with ``?``.) ``$$`` Expands to ``$``. ``$}`` |