aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2009-02-17 07:04:50 +1000
committerGravatar axel <axel@liljencrantz.se>2009-02-17 07:04:50 +1000
commit07717a35702465c96581e6f1c505a0b754f48867 (patch)
tree9c7f32df6e94de6514060ca1f7ba6aa67dd6d0a8
parent79784d3e1867aaaef0f8d2c3779b3080ec2e7bb0 (diff)
Add possibility to define greeting function, suggested by Chris Miller
darcs-hash:20090216210450-ac50b-9b4f7c5bf45afaf21d51e46ff8c2b11d171fcbf2.gz
-rw-r--r--doc_src/index.hdr.in6
-rw-r--r--share/functions/__fish_config_interactive.fish16
2 files changed, 16 insertions, 6 deletions
diff --git a/doc_src/index.hdr.in b/doc_src/index.hdr.in
index 5cf418a5..3e2f9f47 100644
--- a/doc_src/index.hdr.in
+++ b/doc_src/index.hdr.in
@@ -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
diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish
index 02a03663..11ad9854 100644
--- a/share/functions/__fish_config_interactive.fish
+++ b/share/functions/__fish_config_interactive.fish
@@ -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