mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-02 02:41:15 -03:00
Support SHELL_PROMPT_PREFIX, SHELL_PROMPT_SUFFIX, and SHELL_WELCOME
Add support for the SHELL_PROMPT_PREFIX, SHELL_PROMPT_SUFFIX, and SHELL_WELCOME environment variables as standardized by systemd v257. SHELL_PROMPT_PREFIX and SHELL_PROMPT_SUFFIX are automatically prepended and appended to the left prompt at the shell level, so all prompts (default, custom, and sample) pick them up without modification. SHELL_WELCOME is displayed after the greeting when an interactive shell starts. These variables provide a standard interface for tools like systemd's run0 to communicate session context to the shell. Fixes https://github.com/fish-shell/fish-shell/issues/10924 Closes #12570
This commit is contained in:
committed by
Johannes Altmanninger
parent
fdd10ba9b2
commit
484032fa9e
@@ -22,6 +22,8 @@ When an interactive fish starts, it executes fish_greeting and displays its outp
|
||||
|
||||
The default fish_greeting is a function that prints a variable of the same name (``$fish_greeting``), so you can also just change that if you just want to change the text.
|
||||
|
||||
If :envvar:`SHELL_WELCOME` is set, it is displayed after the greeting. This is a standard environment variable that may be set by tools like systemd's ``run0`` to display session information.
|
||||
|
||||
While you could also just put ``echo`` calls into config.fish, fish_greeting takes care of only being used in interactive shells, so it won't be used e.g. with ``scp`` (which executes a shell), which prevents some errors.
|
||||
|
||||
Example
|
||||
|
||||
@@ -24,6 +24,8 @@ The exit status of commands within ``fish_prompt`` will not modify the value of
|
||||
|
||||
If :envvar:`fish_transient_prompt` is set to 1, ``fish_prompt --final-rendering`` is run before executing the commandline.
|
||||
|
||||
If :envvar:`SHELL_PROMPT_PREFIX` or :envvar:`SHELL_PROMPT_SUFFIX` are set, they are automatically prepended and appended to the left prompt. This applies to all prompts regardless of whether ``fish_prompt`` has been customized.
|
||||
|
||||
``fish`` ships with a number of example prompts that can be chosen with the ``fish_config`` command.
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user