2005-09-20 21:31:55 +08:00
|
|
|
\section functions functions - print or erase functions
|
|
|
|
|
2014-08-01 10:37:32 +08:00
|
|
|
\subsection functions-synopsis Synopsis
|
2014-08-01 20:25:41 +08:00
|
|
|
\fish{synopsis}
|
2014-08-01 10:37:32 +08:00
|
|
|
functions [-a|--all] [-n|--names]
|
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 15:56:01 +08:00
|
|
|
functions -c OLDNAME NEWNAME
|
|
|
|
functions -d DESCRIPTION FUNCTION
|
2014-08-01 10:37:32 +08:00
|
|
|
functions [-eq] FUNCTIONS...
|
|
|
|
\endfish
|
2005-09-20 21:31:55 +08:00
|
|
|
|
|
|
|
\subsection functions-description Description
|
|
|
|
|
2014-08-01 10:37:32 +08:00
|
|
|
`functions` prints or erases functions.
|
2005-09-20 21:31:55 +08:00
|
|
|
|
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 15:56:01 +08:00
|
|
|
The following options are available:
|
|
|
|
|
2014-08-01 10:37:32 +08:00
|
|
|
- `-a` or `--all` lists all functions, even those whose name start with an underscore.
|
|
|
|
- `-c OLDNAME NEWNAME` or `--copy OLDNAME NEWNAME` creates a new function named NEWNAME, using the definition of the OLDNAME function.
|
|
|
|
- `-d DESCRIPTION` or `--description=DESCRIPTION` changes the description of this function.
|
|
|
|
- `-e` or `--erase` causes the specified functions to be erased.
|
|
|
|
- `-h` or `--help` displays a help message and exits.
|
|
|
|
- `-n` or `--names` lists the names of all defined functions.
|
|
|
|
- `-q` or `--query` tests if the specified functions exist.
|
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 15:56:01 +08:00
|
|
|
|
2014-08-01 10:37:32 +08:00
|
|
|
The default behavior of `functions`, when called with no arguments,
|
|
|
|
is to print the names of all defined functions. Unless the `-a` option is
|
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 15:56:01 +08:00
|
|
|
given, no functions starting with underscores are not included in the output.
|
2005-09-20 21:31:55 +08:00
|
|
|
|
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 15:56:01 +08:00
|
|
|
If any non-option parameters are given, the definition of the specified
|
2010-09-18 10:18:26 +08:00
|
|
|
functions are printed.
|
2005-09-20 21:31:55 +08:00
|
|
|
|
2014-08-01 10:37:32 +08:00
|
|
|
Automatically loaded functions cannot be removed using `functions
|
|
|
|
-e`. Either remove the definition file or change the
|
2006-07-13 01:46:55 +08:00
|
|
|
$fish_function_path variable to remove autoloaded functions.
|
2005-09-20 21:31:55 +08:00
|
|
|
|
2014-08-01 10:37:32 +08:00
|
|
|
Copying a function using `-c` copies only the body of the function, and
|
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 15:56:01 +08:00
|
|
|
does not attach any event notifications from the original function.
|
|
|
|
|
|
|
|
Only one function's description can be changed in a single invocation
|
2014-08-01 10:37:32 +08:00
|
|
|
of `functions -d`.
|
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 15:56:01 +08:00
|
|
|
|
2014-08-01 10:37:32 +08:00
|
|
|
The exit status of `functions` is the number of functions
|
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 15:56:01 +08:00
|
|
|
specified in the argument list that do not exist, which can be used in
|
2014-08-01 10:37:32 +08:00
|
|
|
concert with the `-q` option.
|
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 15:56:01 +08:00
|
|
|
|
|
|
|
\subsection functions-example Examples
|
|
|
|
|
2014-08-01 10:37:32 +08:00
|
|
|
`functions -n` displays a list of currently-defined functions.
|
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 15:56:01 +08:00
|
|
|
|
2014-08-01 10:37:32 +08:00
|
|
|
`functions -c foo bar` copies the `foo` function to a new function called
|
|
|
|
`bar`.
|
2010-09-12 18:29:34 +08:00
|
|
|
|
2014-08-01 10:37:32 +08:00
|
|
|
`functions -e bar` erases the function `bar`.
|