March 19, 2019
Pimp the bash prompt with Go Bullet Train (GBT)
Pimp the bash prompt with a fast PS1 builder with a lot of ways for you to customize. Meet the Go Bullet Train I’ve been playing around with powerline and quite liked it but I was never really completely satisfied. I though the powerline was quite slow, not extremely slow but slow enough for me to get a bit frustrated. I also thought it was a bit of a hassle to update all my devices with new config when I decided to change the prompt.
This is where gbt comes to the rescue, it’s fast and has the possibility to forward prompts to remote servers with a bash implementation gbts
this is how my prompt looks like right now
I’m using nerdfont, the ‘hack’ version of it to be specific. A nerdfont is more or less needed if you want to display OS logo in your bash prompt.
download a nerdfont https://nerdfonts.com/ unzip it to ~/.fonts and run following command to update font cache
fc-cache -fv
First make sure you have go installed and fetch the code and install it as your normal user
sudo zypper in go1.11
go get -u github.com/jtyr/gbt/cmd/gbt
go install github.com/jtyr/gbt/cmd/gbt
gbt has a lot of settings, this is my configuration in my .bashrc
if [[ -f ~/go/bin/gbt ]]; then
export VIRTUAL_ENV_DISABLE_PROMPT=1
export PS1='$(~/go/bin/gbt)'
export GBT_CARS='OS, Git, Dir, PyVirtEnv, Custom1, Custom2, Custom3, Status, Sign'
export GBT_CAR_OS_NAME='opensuse'
export GBT_CAR_PYVIRTENV_FORMAT=''
export GBT_CAR_DIR_BG='dark_gray'
export GBT_CAR_DIR_DEPTH='3'
export GBT_CAR_STATUS_FORMAT=' '
export GBT_CAR_SIGN_USER_TEXT=''
export GBT_CAR_CUSTOM1_TEXT_TEXT='MyDot: error'
export GBT_CAR_CUSTOM1_BG='red'
export GBT_CAR_CUSTOM1_DISPLAY_CMD="/home/jonas/bin/mydot_gbt_status.sh check_error"
export GBT_CAR_CUSTOM1_TEXT_TEXT='MyDot: err'
export GBT_CAR_CUSTOM2_BG='green'
export GBT_CAR_CUSTOM2_FG='black'
export GBT_CAR_CUSTOM2_TEXT_TEXT='MyDot: commit'
export GBT_CAR_CUSTOM2_DISPLAY_CMD="/home/jonas/bin/mydot_gbt_status.sh check_status"
export GBT_CAR_CUSTOM3_TEXT_TEXT='MyDot: push'
export GBT_CAR_CUSTOM3_BG='green'
export GBT_CAR_CUSTOM3_FG='black'
export GBT_CAR_CUSTOM3_DISPLAY_CMD="/home/jonas/bin/mydot_gbt_status.sh check_pull"
#Prompt forward:
export GBT__HOME="${HOME}/go/src/github.com/jtyr/gbt"
export GBT__CARS_REMOTE='OS, Hostname, Git, Dir, Status, Sign'
export GBT__THEME_SSH="${HOME}/.gbts_theme.sh"
source ~/go/src/github.com/jtyr/gbt/sources/gbts/cmd/local.sh
alias ssh='gbt_ssh'
fi
the prompt forward theme looks like this
export GBT_CARS="${GBT__THEME_REMOTE_CARS:=OS, Hostname, Git, Dir, Status, Sign}"
export GBT_CAR_DIR_BG='dark_gray'
export GBT_CAR_DIR_DEPTH='3'
export GBT_CAR_SIGN_USER_TEXT=''
export GBT_CAR_STATUS_FORMAT=' '
export GBT_CAR_HOSTNAME_ADMIN_FG='light_red'
export GBT_CAR_HOSTNAME_USER_FG='green'
export GBT_CAR_HOSTNAME_USER_BG='dark_gray'
export GBT_CAR_HOSTNAME_HOST_FG='light_green'
export GBT_CAR_HOSTNAME_HOST_BG='dark_gray'
export GBT_CAR_HOSTNAME_HOST_FM='bold'
I do have some issues that I’ve not figured out yet.
unable to force pseudo-terminal allocation with thefixed in commit c6fd3cagbt_ssh
aliasI’m unable to remove thefixed in commit c02a775GBT_CAR_SIGN_USER_TEXT
with prompt forward
But so far I can live with thouse issues
Meta
- Tagged in: leap15 | opensuse | bash | golang
- Next post: Playing With DOH