aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc_src/function.txt
diff options
context:
space:
mode:
authorGravatar David Adam (zanchey) <zanchey@ucc.gu.uwa.edu.au>2013-07-29 16:06:05 +0800
committerGravatar David Adam (zanchey) <zanchey@ucc.gu.uwa.edu.au>2013-07-29 16:07:00 +0800
commit27d84ef8bec7eaf9d6eda54ab29f1572fc9197af (patch)
tree7e0c40e643874daa70296b6a10f4eb71c662ebe7 /doc_src/function.txt
parentbe77b9201e003cd11bd638f01882a4be0b9905e9 (diff)
documentation for test and function (closes: #734)
plus speling in documentation for bind. Note that this commit does not re-enable the generation of the manpage for test, which will therefore still fall through to the system manual page with `man test`.
Diffstat (limited to 'doc_src/function.txt')
-rw-r--r--doc_src/function.txt5
1 files changed, 4 insertions, 1 deletions
diff --git a/doc_src/function.txt b/doc_src/function.txt
index c072c551..8d8e4519 100644
--- a/doc_src/function.txt
+++ b/doc_src/function.txt
@@ -12,16 +12,19 @@ function is given as a command.
The following options are available:
+- <code>-a NAMES</code> or <code>--argument-names NAMES</code> assigns the value of successive command-line arguments to the names given in NAMES.
- <code>-d DESCRIPTION</code> or \c --description=DESCRIPTION is a description of what the function does, suitable as a completion description.
- <code>-e</code> or <code>--on-event EVENT_NAME</code> tells fish to run this function when the specified named event is emitted. Fish internally generates named events e.g. when showing the prompt.
- <code>-j PID</code> or <code> --on-job-exit PID</code> tells fish to run this function when the job with group ID PID exits. Instead of PID, the string 'caller' can be specified. This is only legal when in a command substitution, and will result in the handler being triggered by the exit of the job which created this command substitution.
- <code>-p PID</code> or <code> --on-process-exit PID</code> tells fish to run this function when the fish child process with process ID PID exits.
- <code>-s</code> or <code>--on-signal SIGSPEC</code> tells fish to run this function when the signal SIGSPEC is delivered. SIGSPEC can be a signal number, or the signal name, such as SIGHUP (or just HUP).
+- \c -S or \c --no-scope-shadowing allows the function to access the variables of calling functions. Normally, any variables inside the function that have the same name as variables from the calling function are "shadowed", and their contents is independent of the calling function.
- <code>-v</code> or <code>--on-variable VARIABLE_NAME</code> tells fish to run this function when the variable VARIABLE_NAME changes value.
If the user enters any additional arguments after the function, they
are inserted into the environment <a href="index.html#variables-arrays">variable array</a>
-<code>$argv</code>.
+<code>$argv</code>. If the \c --argument-names option is provided, the arguments are
+also assigned to names specified in that option.
By using one of the event handler switches, a function can be made to run automatically at specific events. The user may generate new events using the <a href="#emit">emit</a> builtin. Fish generates the following named events: