mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-12-03 00:16:20 +08:00
72a44460c6
This adds a "fish_greeting" function that prints the variable of the same name. In doing so, it makes $fish_greeting default to a global variable (this is of little cost because of the `_` builtin) This means that: - We have fewer universal variables by default - If we change the default greeting people will actually get - it (unless they have a leftover universal, of course) - If the user changes their language the variable changes with it
18 lines
718 B
Fish
18 lines
718 B
Fish
function fish_greeting
|
|
if not set -q fish_greeting
|
|
set -l line1 (_ 'Welcome to fish, the friendly interactive shell')
|
|
set -l line2 \n(printf (_ 'Type %shelp%s for instructions on how to use fish') (set_color green) (set_color normal))
|
|
set -g fish_greeting "$line1$line2"
|
|
end
|
|
|
|
if set -q fish_private_mode
|
|
set -l line (_ "fish is running in private mode, history will not be persisted.")
|
|
set -g fish_greeting $fish_greeting.\n$line
|
|
end
|
|
|
|
# The greeting used to be skipped when fish_greeting was empty (not just undefined)
|
|
# Keep it that way to not print superfluous newlines on old configuration
|
|
test -n "$fish_greeting"
|
|
and echo $fish_greeting
|
|
end
|