Add possibility to define greeting function, suggested by Chris Miller

darcs-hash:20090216210450-ac50b-9b4f7c5bf45afaf21d51e46ff8c2b11d171fcbf2.gz
This commit is contained in:
axel 2009-02-17 07:04:50 +10:00
parent 79784d3e18
commit 07717a3570
2 changed files with 16 additions and 6 deletions

View file

@ -1256,6 +1256,12 @@ end
</pre>
</p>
\subsection greeting Configurable greeting
If a function named fish_greeting exists after initialization, it will
be run when entering interactive mode. Otherwise,if an environment
variable named fish_greeting exists, it will be printed.
\subsection event Event handlers
When defining a new function in fish, it is possible to make it into an

View file

@ -146,13 +146,17 @@ function __fish_config_interactive -d "Initializations that should be performed
# Print a greeting
#
if set -q fish_greeting
switch $fish_greeting
case ''
# If variable is empty, don't print anything, saves us a fork
if functions -q fish_greeting
fish_greeting
else
if set -q fish_greeting
switch $fish_greeting
case ''
# If variable is empty, don't print anything, saves us a fork
case '*'
echo $fish_greeting
case '*'
echo $fish_greeting
end
end
end