mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-28 05:43:11 +00:00
38b24c2325
This makes it so we link to the very top of the document instead of a special anchor we manually include. So clicking e.g. :doc:`string <cmds/string>` will link you to cmds/string.html instead of cmds/string.html#cmd-string. I would love to have a way to say "this document from the root of the document path", but that doesn't appear to work, I tried `/cmds/string`. So we'll just have to use cmds/string in normal documents and plain `string` from other commands.
60 lines
1.5 KiB
ReStructuredText
60 lines
1.5 KiB
ReStructuredText
.. _cmd-block:
|
|
|
|
block - temporarily block delivery of events
|
|
============================================
|
|
|
|
Synopsis
|
|
--------
|
|
|
|
.. synopsis::
|
|
|
|
block [(--local | --global)]
|
|
block --erase
|
|
|
|
Description
|
|
-----------
|
|
|
|
``block`` prevents events triggered by ``fish`` or the :doc:`emit <emit>` command from being delivered and acted upon while the block is in place.
|
|
|
|
In functions, ``block`` can be useful while performing work that should not be interrupted by the shell.
|
|
|
|
The block can be removed. Any events which triggered while the block was in place will then be delivered.
|
|
|
|
Event blocks should not be confused with code blocks, which are created with ``begin``, ``if``, ``while`` or ``for``
|
|
|
|
Without options, the ``block`` command acts with function scope.
|
|
|
|
The following options are available:
|
|
|
|
**-l** or **--local**
|
|
Release the block automatically at the end of the current innermost code block scope.
|
|
|
|
**-g** or **--global**
|
|
Never automatically release the lock.
|
|
|
|
**-e** or **--erase**
|
|
Release global block.
|
|
|
|
**-h** or **--help**
|
|
Displays help about using this command.
|
|
|
|
Example
|
|
-------
|
|
::
|
|
|
|
# Create a function that listens for events
|
|
function --on-event foo foo; echo 'foo fired'; end
|
|
|
|
# Block the delivery of events
|
|
block -g
|
|
|
|
emit foo
|
|
# No output will be produced
|
|
|
|
block -e
|
|
# 'foo fired' will now be printed
|
|
|
|
Notes
|
|
-----
|
|
|
|
Events are only received from the current fish process as there is no way to send events from one fish process to another (yet).
|