Skip to content

Commit

Permalink
add new 'import.return' command
Browse files Browse the repository at this point in the history
  • Loading branch information
pyroscope committed May 31, 2018
1 parent da3dfc2 commit 2c504f0
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions docs/include-cmd-scripting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,34 @@ Importing Script Files
import = (cat, (cfg.basedir), "_rtlocal.rc")
import.return

.. code-block:: ini
# rTorrent-PS 1.1+ only
import.return= ≫ throw('import.return')
Leaves the currently imported file and returns to the level above.

Since this works by throwing an exception, you will see that
exception when called *outside* of an imported file.

To use this in a way compatible with older builds, protect an import like this:

.. code-block:: ini
branch=(system.has, "import.return="), ((import, using-math-stuff.rc))
Then in the ``using-math-stuff.rc`` file, you can return when certain capabilities are missing.

.. code-block:: ini
branch=(not, (system.has, "math.add=")), ((import.return))
You can do this incrementally ordered from older to younger capabilities,
using exactly those features a build has to offer.


.. _cond-cmds:

Conditions (if/then/else)
Expand Down

0 comments on commit 2c504f0

Please sign in to comment.