rush / docs

Configuration

Rush reads interactive configuration from Rush scripts.

Files

Rush loads system and user configuration, then sources the file named by ENV for interactive startup.

/etc/rush/config.rush
$XDG_CONFIG_HOME/rush/config.rush
$HOME/.config/rush/config.rush
$ENV

Prompt

Define rush_prompt to build the interactive prompt.

rush_prompt() {
  prompt segment --fg blue "$(prompt_pwd)"
  prompt text ' $ '
}

The prompt command is only available while Rush is rendering the prompt.

Prompt commands

prompt text TEXT...
prompt segment [OPTIONS] TEXT...
prompt newline

prompt text appends plain text. prompt segment appends styled text. prompt newline starts a new prompt line.

Segment options

--fg COLOR
--bg COLOR
--bold
--dim
--italic
--underline
--blink
--reverse
--strikethrough

Colors may be named colors, 256-color indexes, or RGB hex values.

blue
bright-blue
index:236
'#7aa2f7'

Helpers

prompt_pwd       # current directory, with $HOME shortened to ~
prompt_duration  # previous command duration

PS1 fallback

If rush_prompt is not defined, Rush uses PS1. Rush initializes PS1 to $ and PS2 to > for interactive shells.

PS1='rush$ '
PS2='> '

Example

File: $HOME/.config/rush/config.rush

rush_prompt() {
  prompt segment --fg bright-blue "$(prompt_pwd)"

  if test "$(prompt_duration)" != ""; then
    prompt text ' '
    prompt segment --dim "$(prompt_duration)"
  fi

  prompt text ' $ '
}

Status

Configuration is early. Expect changes.