From 07717a35702465c96581e6f1c505a0b754f48867 Mon Sep 17 00:00:00 2001 From: axel Date: Tue, 17 Feb 2009 07:04:50 +1000 Subject: Add possibility to define greeting function, suggested by Chris Miller darcs-hash:20090216210450-ac50b-9b4f7c5bf45afaf21d51e46ff8c2b11d171fcbf2.gz --- doc_src/index.hdr.in | 6 ++++++ share/functions/__fish_config_interactive.fish | 16 ++++++++++------ 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

+\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 -- cgit v1.2.3