PROMPT(1)

NAME

prompt - append styled text while rendering the interactive prompt.

SYNOPSIS

prompt text text...
prompt segment [--fg color] [--bg color] [--bold] [--dim] [--italic] [--underline] [--reverse] [--strikethrough] text...
prompt async key --ttl milliseconds [--prefix text] [--fg color] [--bg color] [--bold] [--dim] [--italic] [--underline] [--reverse] [--strikethrough] -- command...
prompt newline
prompt async-pending

DESCRIPTION

prompt appends content to the prompt currently being rendered by rush_prompt. It is only available while Rush is rendering the interactive prompt.

prompt text appends plain text. prompt segment appends styled text. prompt async appends cached command output and refreshes stale values in the background. prompt newline starts a new prompt line. prompt async-pending exits successfully when a prompt async refresh is currently running, and exits non-zero otherwise.

prompt async is for prompt data that may be slow to compute, such as Git state. It appends cached standard output immediately. If the cache is missing or older than the requested TTL, Rush starts command as a hidden refresh and uses the old cached value, or appends nothing if no value has been cached yet. When the hidden command exits, Rush automatically requests a safe prompt redraw.

Cache entries are keyed by the current directory plus key. Duplicate refreshes for the same cache entry are coalesced. Standard error from hidden refreshes is suppressed, and refreshes do not change the interactive shell's last status.

Colors accept the same values as Rush editor styles: default, ANSI color names, bright color names, 256-color indexes, and #rrggbb truecolor values.

EXIT STATUS

Zero on success or when prompt async starts a refresh, one when prompt async-pending has no running refresh, and two for usage errors or invalid style options. Hidden command failures do not directly become the status of prompt async.

SEE ALSO

rush-builtins(7), prompt_duration(1), prompt_pwd(1), rush configuration.