aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc_src/function.txt
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-08-15 18:14:36 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-08-15 18:14:36 -0700
commit06400b83b188156f31ed92216ec27122d29f88cd (patch)
tree2f9cec409aba50449638c8d4361b4dafe530f3ec /doc_src/function.txt
parentfe68d30be97853865b24ad5f5998d3e50769f860 (diff)
Support for command wrapping ("aliases")
Add the --wraps option to 'complete' and 'function'. This allows a command to (recursively) inherit the completions of a wrapped command. Fixes #393. When evaluating a completion, we inspect the entire "wrap chain" for a command, i.e. we follow the sequence of wrapping until we either hit a loop (which we silently ignore) or the end of the chain. We then evaluate completions as if the wrapping command were substituted with the wrapped command. Currently this only works for commands, i.e. 'complete --command gco --wraps git\ checkout' won't work (that would seem to encroaching on abbreviations anyways). It might be useful to show an error message for that case. The commandline builtin reflects the commandline with the wrapped command substituted in, so e.g. git completions (which inspect the command line) will just work. This sort of command line munging is also performed by 'complete -C' so it's not totally without precedent. 'alias will also now mark its generated function as wrapping the 'target.
Diffstat (limited to 'doc_src/function.txt')
-rw-r--r--doc_src/function.txt1
1 files changed, 1 insertions, 0 deletions
diff --git a/doc_src/function.txt b/doc_src/function.txt
index 8d8e4519..cadc0d26 100644
--- a/doc_src/function.txt
+++ b/doc_src/function.txt
@@ -14,6 +14,7 @@ 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>-w WRAPPED_COMMAND</code> or \c --wraps=WRAPPED_COMMAND causes the function to inherit completions from the given wrapped command. See the documentation for \c complete for more information.
- <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.