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.
This commit is contained in:
David Adam (zanchey)
2013-05-12 15:56:01 +08:00
committed by ridiculousfish
parent 91aab03b90
commit 1287b9d823
70 changed files with 726 additions and 509 deletions

View File

@@ -1,4 +1,4 @@
\section set set - handle environment variables.
\section set set - display and change environment variables.
\subsection set-synopsis Synopsis
<pre>
@@ -10,31 +10,39 @@ set (-e | --erase) [SCOPE_OPTIONS] VARIABLE_NAME
set (-e | --erase) [SCOPE_OPTIONS] VARIABLE_NAME[INDICES]...
</pre>
The <code>set</code> builtin causes fish to assign the variable <code>VARIABLE_NAME</code> the values <code>VALUES...</code>.
\subsection set-description Description
- <code>-e</code> or <code>--erase</code> causes the specified environment variable to be erased
- <code>-l</code> or <code>--local</code> forces the specified environment variable to be given a scope that is local to the current block, even if a variable with the given name exists and is non-local
- <code>-g</code> or <code>--global</code> causes the specified environment variable to be given a global scope. Non-global variables disappear when the block they belong to ends
- <code>-U</code> or <code>--universal</code> causes the specified environment variable to be given a universal scope. If this option is supplied, the variable will be shared between all the current users fish instances on the current computer, and will be preserved across restarts of the shell.
- <code>-n</code> or <code>--names</code> List only the names of all defined variables, not their value
- <code>-q</code> or <code>--query</code> test if the specified variable names are defined. Does not output anything, but the builtins exit status is the number of variables specified that were not defined.
- <code>-u</code> or <code>--unexport</code> causes the specified environment not to be exported to child processes
- <code>-x</code> or <code>--export</code> causes the specified environment variable to be exported to child processes
- <code>-L</code> or <code>--long</code> do not abbreviate long values when printing set variables
<code>set</code> manipulates <a href="index.html#variables">environment
variables</a>.
If set is called with no arguments, the names and values of all
environment variables are printed. If some of the scope or export
flags have been given, only the variables matching the specified scope
are printed.
With both variable names and values provided, \c set assigns the variable
<code>VARIABLE_NAME</code> the values <code>VALUES...</code>.
The following options control variable scope:
- <code>-l</code> or <code>--local</code> forces the specified environment variable to be given a scope that is local to the current block, even if a variable with the given name exists and is non-local
- <code>-g</code> or <code>--global</code> causes the specified environment variable to be given a global scope. Non-global variables disappear when the block they belong to ends
- <code>-U</code> or <code>--universal</code> causes the specified environment variable to be given a universal scope. If this option is supplied, the variable will be shared between all the current users fish instances on the current computer, and will be preserved across restarts of the shell.
- <code>-n</code> or <code>--names</code> List only the names of all defined variables, not their value
- <code>-u</code> or <code>--unexport</code> causes the specified environment not to be exported to child processes
- <code>-x</code> or <code>--export</code> causes the specified environment variable to be exported to child processes
The following options are available:
- <code>-e</code> or <code>--erase</code> causes the specified environment variable to be erased
- <code>-q</code> or <code>--query</code> test if the specified variable names are defined. Does not output anything, but the builtins exit status is the number of variables specified that were not defined.
- <code>-L</code> or <code>--long</code> do not abbreviate long values when printing set variables
If a variable is set to more than one value, the variable will be an
array with the specified elements. If a variable is set to zero
elements, it will become an array with zero elements.
If the variable name is one or more array elements, such as
<code>PATH[1 3 7]</code>, only those array elements specified will be
changed. When array indices are specified to set, multiple arguments
changed. When array indices are specified to \c set, multiple arguments
may be used to specify additional indexes, e.g. <code>set PATH[1]
PATH[4] /bin /sbin</code>. If you specify a negative index when
expanding or assigning to an array variable, the index will be
@@ -63,17 +71,17 @@ be specified. That way, a global variable can be erased even if a
local variable with the same name exists. Scope can not be specified
when erasing a slice of an array. The innermost scope is always used.
The set command requires all switch arguments to come before any
non-switch arguments. For example, <code>set flags -l</code> will have
\c set requires all options to come before any
other arguments. For example, <code>set flags -l</code> will have
the effect of setting the value of the variable <code>flags</code> to
'-l', not making the variable local.
In assignment mode, set exits with a non-zero exit status if variable
In assignment mode, \c set exits with a non-zero exit status if variable
assignments could not be successfully performed. If the variable assignments
were performed, the exit status is unchanged. This allows simultaneous capture
of the output and exit status of a subcommand, e.g. <code>if set output
(command)</code>. In query mode, the exit status is the number of variables that
were not found. In erase mode, set exits with a zero exit status in case of
were not found. In erase mode, \c set exits with a zero exit status in case of
success, with a non-zero exit status if the commandline was invalid, if the
variable was write-protected or if the variable did not exist.