auraline
auraline is a utility that renders information into a string suitable to be embedded
in the shell prompt. It is written in Rust.
Build
To build the package run the following commands:
This will build and install the binary auraline in the Cargo bin directory (e.g., ~/.cargo/bin/).
Building auraline Statically
To statically build auraline, you can use the following command:
RUSTFLAGS='-C target-feature=+crt-static'
This command will instruct Cargo to build auraline with static linking, which will create a static binary. The binary will include all necessary dependencies, making it more self-contained and easier to distribute.
Usage
Usage: auraline [OPTIONS]
Options:
-p, --path <PATH> Specify a path where to run the line ($PWD by default)
-t, --theme <THEME> Specify the theme color
-s, --short-mode Enable short mode
-f, --fast Fast mode
-n, --nerd-font Use Nerd Fonts
-h, --help Print help
-V, --version Print version
Theme Color
The --theme option allows you to customize the color of the prompt. You can use one of the predefined color names or a true color value.
Predefined Colors
You can use any of the following predefined color names:
blackredgreenyellowbluemagentacyanwhitepurplebright_blackbright_redbright_greenbright_yellowbright_bluebright_magentabright_cyanbright_white
Example:
auraline --theme red
True Color
You can also specify a true color value in the format r,g,b, where r, g, and b are integers from 0 to 255.
Example:
auraline --theme 128,0,128
Nerd Fonts
The -n or --nerd-font option enables the use of Nerd Fonts for icons and symbols in the prompt.
Make sure you have a Nerd Font installed and configured in your terminal for the symbols to render correctly.
Bash
To use it with bash, configure the shell prompt as follow:
PS1='\u@\h :: \[\033[1;32m\]\w\[\033[0m\] $(~/.cargo/bin/auraline --theme blue -n)\n-> '
Zsh
For zsh, try the following configuration in .zshrc:
&&
PS1="%{[green]%}%n@%m %{[blue]%}%c %# "
Fish
For fish shell, define the following function in ~/.config/fish/functions/fish`_prompt.fish:
function fish_prompt --description 'Write out the prompt'
set -l last_status $status
set -l git_prompt (~/.cargo/bin/auraline --theme blue -n)
if not set -q __fish_prompt_normal
set -g __fish_prompt_normal (set_color normal)
end
# PWD
set_color $fish_color_cwd
echo -n (prompt_pwd)
set_color normal
printf '%s ' "{$git_prompt}"
if not test $last_status -eq 0
set_color $fish_color_error
end
echo -n '$ '
end