Highly configurable prompt builder for Bash, ZSH and PowerShell written in Go. It's inspired by the Oh My ZSH Bullet Train theme but runs significantly faster.
GBT comes with an interesting feature called prompt forwarding which allows to forward user-defined prompt to a remote machine and have the same-looking prompt across all machines via SSH but also in Docker, Kubectl, Vagrant, MySQL or in Screen without the need to install anything remotely.
All the above works well on Linux (Terminator, Konsole, Gnome Terminal), Mac (Terminal, iTerm), Android (Termux) and Windows (PowerShell, Windows Terminal).
In order to setup GBT on your machine, you have to install it, activate it and setup a special font in your terminal (optional).
yaourt -S gbtOr install gbt-git if you would like to run the latest greatest from the
master branch.
Packages hosted by Packagecloud:
echo '[gbt]
name=GBT YUM repo
baseurl=https://packagecloud.io/gbt/release/el/7/$basearch
gpgkey=https://packagecloud.io/gbt/release/gpgkey
https://packagecloud.io/gbt/release/gpgkey/gbt-release-4C6E79EFF45439B6.pub.gpg
gpgcheck=1
repo_gpgcheck=1' | sudo tee /etc/yum.repos.d/gbt.repo >/dev/null
sudo yum install gbtUse the exact repository definition from above for all RedHat-based distribution regardless its version.
Packages hosted by Packagecloud:
curl -L https://packagecloud.io/gbt/release/gpgkey | sudo apt-key add -
echo 'deb https://packagecloud.io/gbt/release/ubuntu/ xenial main' | sudo tee /etc/apt/sources.list.d/gbt.list >/dev/null
sudo apt-get update
sudo apt-get install gbtUse the exact repository definition from above for all Debian-based distribution regardless its version.
Using brew:
brew tap jtyr/repo
brew install gbtOr install gbt-git if you would like to run the latest greatest from the
master branch:
brew tap jtyr/repo
brew install --HEAD gbt-gitUsing choco:
choco install gbtUsing scoop:
scoop install gbtOr manually by copying the gbt.exe file into a directory listed in the PATH
environment variable (e.g. C:\Windows\system32).
Install Termux from Google Play Store and then type this in the Termux app:
apt update
apt install gbtMake sure Go is installed and then run the following on Linux and Mac:
mkdir ~/go
export GOPATH=~/go
export PATH="$PATH:$GOPATH/bin"
go get github.com/jtyr/gbt/cmd/gbtOr the following on Windows using PowerShell:
mkdir ~/go
$Env:GOPATH = '~/go'
$Env:PATH = "~/go/bin;$Env:PATH"
go install github.com/jtyr/gbt/cmd/gbt@latestAfter GBT is installed, it can be activated by calling it from the shell prompt variable:
# For Bash
PS1='$(gbt $?)'
# For ZSH
PROMPT='$(gbt $?)'If you are using ZSH together with some shell framework (e.g. Oh My ZSH), your shell is processing a fair amount of shell scripts upon ever prompt appearance. You can speed up your shell by removing the framework dependency from your configuration and replacing it with GBT and a simple ZSH configuration. Combining pure ZSH configuration with GBT will provide the best possible performance for your shell.
To activate GBT in PowerShell, run the following in the console or store it to
the PowerShell profile file (echo $profile):
function prompt {
$rc = [int]$(-Not $?)
$Env:GBT_SHELL = 'plain'
$Env:PWD = get-location
$Env:GBT_CAR_CUSTOM_EXECUTOR='powershell.exe'
$Env:GBT_CAR_CUSTOM_EXECUTOR_PARAM='-Command'
$gbt_output = & @({gbt $rc},{gbt.exe $rc})[$PSVersionTable.PSVersion.Major -lt 6 -or $IsWindows] | Out-String
$gbt_output = $gbt_output -replace ([Environment]::NewLine + '$'), ''
Write-Host -NoNewline $gbt_output
return [char]0
}
# Needed only on Windows
[console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8EncodingAlthough GBT can be configured to use only ASCII characters (see
basic theme), the default configuration uses
some UTF-8 characters which require special font. In order to display all
characters of the default prompt correctly, the shell should support UTF-8 and
Nerd fonts (or at least the
DejaVuSansMono
Nerd
font) should be installed. On Linux, you can install it like this:
mkdir ~/.fonts
curl -L -o ~/.fonts/DejaVuSansMonoNerdFontCompleteMono.ttf https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/DejaVuSansMono/Regular/complete/DejaVu%20Sans%20Mono%20Nerd%20Font%20Complete%20Mono.ttf
fc-cacheOn Mac, it can be installed via brew:
brew tap homebrew/cask-fonts
brew install --cask font-dejavu-sans-mono-nerd-fontOn Windows, it can be installed via choco:
choco install font-nerd-DejaVuSansMonoOr via scoop:
scoop bucket add nerd-fonts
scoop install DejaVuSansMono-NFOr just download the font, open it and then install it.
Once the font is installed, it has to be set in the terminal application to
render all prompt characters correctly. Search for the font name DejaVuSansMono Nerd Font Mono on Linux and Mac and DejaVuSansMono NF on Windows.
In order to have the Nerd font in Termux on Android, you have to install
Termux:Styling
application. Then longpress the terminal screen and select MORE... → Style
→ CHOOSE FONT and there choose the DejaVu font.
Some Unix terminals might not use 256 color palette by default. In such case try to set the following:
export TERM='xterm-256color'The prompt (train) is assembled from several elements (cars). The look and
behavior of whole train as well as each car can be influenced by a set of
environment variables. To set the environment variable, use export in the
Linux and Mac shell and $Env: on Windows.
The value of all _BG and _FG variables defines the background and
foreground color of the particular element. The value of the color can be
specified in 3 ways:
Only a limited number of named colors is supported:
blackredgreenyellowbluemagentacyanlight_graydark_graylight_redlight_greenlight_yellowlight_bluelight_magentalight_cyanwhitedefault(default color of the terminal)
Examples:
# Set the background color of the `Dir` car to red
export GBT_CAR_DIR_BG='red'
# Set the foreground color of the `Dir` car to white
export GBT_CAR_DIR_FG='white'Color can also by expressed by a single number in the range from 0 to
255. The color of each number in that range is visible in the 256-color
lookup table on
Wikipedia. The named
colors described above are the first 16 numbers from the lookup table.
Examples:
# Set the background color of the `Dir` car to red
export GBT_CAR_DIR_BG='1'
# Set the foreground color of the `Dir` car to white
export GBT_CAR_DIR_FG='15'Arbitrary color can be expressed in the form of RGB triplet.
Examples:
# Set the background color of the `Dir` car to red
export GBT_CAR_DIR_BG='170;0;0'
# Set the foreground color of the `Dir` car to white
export GBT_CAR_DIR_FG='255;255;255'GBT is using 8-bit color palette to color individual cars of the train. First 16 colors (Standart and High-intensity colors) of the palette are prone to a change if the terminal is using some color scheme (e.g. Solarized). That means that if one GBT train uses mixture of the first 16 and the remaining 240 colors, the look might be inconsistent because some of the colors might change (depending on the color scheme) and some not. Luckily the first 16 colors can be found in the remaining 240 colors and therefore GBT can automatically convert the first 16 colors into higher colors which provides consistent look regardless the color scheme. This works automatically for color names as well as for color numbers. If needed, the automatic conversion can be disabled with the following variable:
export GBT_FORCE_HIGHER_COLORS='0'Formatting is done via _FM variables. The possible values are:
-
normalMakes the text normal.
-
dimMakes the text dim.
-
boldMakes the text bold. Not all font characters have variant for bold formatting.
-
underlineMakes the text underlined.
-
blinkMakes the text to blink.
-
invertMakes the text color inverted.
-
hideMakes the text hidden.
-
noneNo formatting applied.
Multiple formattings can be combined into comma-separated list.
Examples:
# Set the directory name to be bold export GBT_CAR_DIR_FM='bold' # Set the directory name to be bold and underlined export GBT_CAR_DIR_FM='bold,underline'
-
GBT_CARS='Status, Os, Hostname, Dir, Git, Sign'List of cars used in the train.
To add a new car into the train, the whole variable must be redefined. For example in order to add the
Timecar into the default set of cars between theOsandHostnamecar, the variable should look like this:export GBT_CARS='Status, Os, Time, Hostname, Dir, Git, Sign'
-
GBT_RCARS='Time'The same like
GBT_CARSbut for the right hand side prompt.# Add the Custom car into the right hand site car to have the separator visible export GBT_RCARS='Custom, Time' # Make the Custom car to be invisible (zero length text) export GBT_CAR_CUSTOM_BG='default' export GBT_CAR_CUSTOM_FORMAT='' # Show only time export GBT_CAR_TIME_FORMAT=' {{ Time }} ' # Set the right hand side prompt (ZSH only) RPROMPT='$(gbt -right)'
-
GBT_SEPARATOR=''Character used to separate cars in the train.
-
GBT_RSEPARATOR=''The same like
GBT_SEPARATORbut for the right hand side prompt. -
GBT_CAR_BGBackground color inherited by the top background color variable of every car. That allows to set the background color of all cars via single variable.
-
GBT_CAR_FGForeground color inherited by the top foreground color variable of every car. That allows to set the foreground color of all cars via single variable.
-
GBT_CAR_FMFormatting inherited by the top formatting variable of every car. That allows to set the formatting of all cars via single variable.
-
GBT_BEGINNING_BG='default'Background color of the text shown at the beginning of the train.
-
GBT_BEGINNING_FG='default'Foreground color of the text shown at the beginning of the train.
-
GBT_BEGINNING_FM='none'Formatting of the text shown at the beginning of the train.
-
GBT_BEGINNING_TEXT=''Text shown at the beginning of the train.
-
GBT_SHELLIndicates which shell is used. The value can be either
zsh,bashorplain. By default, the value is extracted from the$SHELLenvironment variable. Set this variable tobashif your default shell is ZSH but you want to test GBT in Bash:export GBT_SHELL='bash' bash
If set to
plain, no shell-specific decoration is included in the output text. That's suitable for displaying the GBT-generated string in the console output. -
GBT_DEBUG='0'Shows more verbose output if some of the car modules cannot be imported.
Car that displays information about the local AWS configuration.
-
GBT_CAR_AWS_BG='166'Background color of the car.
-
GBT_CAR_AWS_FG='white'Foreground color of the car.
-
GBT_CAR_AWS_FM='none'Formatting of the car.
-
GBT_CAR_AWS_FORMAT=' {{ Icon }} {{ Project }} 'Format of the car.
-
GBT_CAR_AWS_ICON_BGBackground color of the
{{ Icon }}element. -
GBT_CAR_AWS_ICON_FGForeground color of the
{{ Icon }}element. -
GBT_CAR_AWS_ICON_FMFormatting of the
{{ Icon }}element. -
GBT_CAR_AWS_ICON_TEXT=''Text content of the
{{ Icon }}element. -
GBT_CAR_AWS_PROFILE_BGBackground color of the
{{ Profile }}element. -
GBT_CAR_AWS_PROFILE_FGForeground color of the
{{ Profile }}element. -
GBT_CAR_AWS_PROFILE_FMFormatting of the
{{ Profile }}element. -
GBT_CAR_AWS_PROFILE_TEXTText content of the
{{ Profile }}element specifying the configured profile. -
GBT_CAR_AWS_REGION_BGBackground color of the
{{ Region }}element. -
GBT_CAR_AWS_REGION_FGForeground color of the
{{ Region }}element. -
GBT_CAR_AWS_REGION_FMFormatting of the
{{ Region }}element. -
GBT_CAR_AWS_REGION_TEXTText content of the
{{ Region }}element specifying the configured region. -
GBT_CAR_AWS_DISPLAYWhether to display this car if it's in the list of cars (
GBT_CARS). -
GBT_CAR_AWS_WRAP='0'Whether to wrap the prompt line in front of this car.
-
GBT_CAR_AWS_SEP_TEXTText content of the separator for this car.
-
GBT_CAR_AWS_SEP_BGBackground color of the separator for this car.
-
GBT_CAR_AWS_SEP_FGForeground color of the separator for this car.
-
GBT_CAR_AWS_SEP_FMFormatting of the separator for this car.
Car that displays information about the local Azure configuration.
-
GBT_CAR_AZURE_BG='32'Background color of the car.
-
GBT_CAR_AZURE_FG='white'Foreground color of the car.
-
GBT_CAR_AZURE_FM='none'Formatting of the car.
-
GBT_CAR_AZURE_FORMAT=' {{ Icon }} {{ Subscription }} 'Format of the car.
-
GBT_CAR_AZURE_ICON_BGBackground color of the
{{ Icon }}element. -
GBT_CAR_AZURE_ICON_FGForeground color of the
{{ Icon }}element. -
GBT_CAR_AZURE_ICON_FMFormatting of the
{{ Icon }}element. -
GBT_CAR_AZURE_ICON_TEXT='ﴃ'Text content of the
{{ Icon }}element. -
GBT_CAR_AZURE_CLOUD_BGBackground color of the
{{ Cloud }}element. -
GBT_CAR_AZURE_CLOUD_FGForeground color of the
{{ Cloud }}element. -
GBT_CAR_AZURE_CLOUD_FMFormatting of the
{{ Cloud }}element. -
GBT_CAR_AZURE_CLOUD_TEXTText content of the
{{ Cloud }}element specifying the configured cloud. -
GBT_CAR_AZURE_SUBSCRIPTION_BGBackground color of the
{{ Subscription }}element. -
GBT_CAR_AZURE_SUBSCRIPTION_FGForeground color of the
{{ Subscription }}element. -
GBT_CAR_AZURE_SUBSCRIPTION_FMFormatting of the
{{ Subscription }}element. -
GBT_CAR_AZURE_SUBSCRIPTION_TEXTText content of the
{{ Subscription }}element specifying the configured subscription. -
GBT_CAR_AZURE_USERNAME_BGBackground color of the
{{ UserName }}element. -
GBT_CAR_AZURE_USERNAME_FGForeground color of the
{{ UserName }}element. -
GBT_CAR_AZURE_USERNAME_FMFormatting of the
{{ UserName }}element. -
GBT_CAR_AZURE_USERNAME_TEXTText content of the
{{ UserName }}element specifying the configured user name. -
GBT_CAR_AZURE_USERTYPE_BGBackground color of the
{{ UserType }}element. -
GBT_CAR_AZURE_USERTYPE_FGForeground color of the
{{ UserType }}element. -
GBT_CAR_AZURE_USERTYPE_FMFormatting of the
{{ UserType }}element. -
GBT_CAR_AZURE_USERTYPE_TEXTText content of the
{{ UserType }}element specifying the configured user type. -
GBT_CAR_AZURE_STATE_BGBackground color of the
{{ State }}element. -
GBT_CAR_AZURE_STATE_FGForeground color of the
{{ State }}element. -
GBT_CAR_AZURE_STATE_FMFormatting of the
{{ State }}element. -
GBT_CAR_AZURE_STATE_TEXTText content of the
{{ State }}element specifying the configured subscription state. -
GBT_CAR_AZURE_DEFAULTS_GROUP_BGBackground color of the
{{ DefaultsGroup }}element. -
GBT_CAR_AZURE_DEFAULTS_GROUP_FGForeground color of the
{{ DefaultsGroup }}element. -
GBT_CAR_AZURE_DEFAULTS_GROUP_FMFormatting of the
{{ DefaultsGroup }}element. -
GBT_CAR_AZURE_DEFAULTS_GROUP_TEXTText content of the
{{ DefaultsGroup }}element specifying the configured default resource group. -
GBT_CAR_AZURE_DISPLAYWhether to display this car if it's in the list of cars (
GBT_CARS). -
GBT_CAR_AZURE_WRAP='0'Whether to wrap the prompt line in front of this car.
-
GBT_CAR_AZURE_SEP_TEXTText content of the separator for this car.
-
GBT_CAR_AZURE_SEP_BGBackground color of the separator for this car.
-
GBT_CAR_AZURE_SEP_FGForeground color of the separator for this car.
-
GBT_CAR_AZURE_SEP_FMFormatting of the separator for this car.
The main purpose of this car is to provide the possibility to create car with custom text.
-
GBT_CAR_CUSTOM_BG='yellow'Background color of the car.
-
GBT_CAR_CUSTOM_FG='default'Foreground color of the car.
-
GBT_CAR_CUSTOM_FM='none'Formatting of the car.
-
GBT_CAR_CUSTOM_FORMAT=' {{ Text }} 'Format of the car.
-
GBT_CAR_CUSTOM_TEXT_BGBackground color of the
{{ Text }}element. -
GBT_CAR_CUSTOM_TEXT_FGForeground color of the
{{ Text }}element. -
GBT_CAR_CUSTOM_TEXT_FMFormatting of the
{{ Text }}element. -
GBT_CAR_CUSTOM_TEXT_TEXT='?'Text content of the
{{ Text }}element. -
GBT_CAR_CUSTOM_TEXT_CMDThe
{{ Text }}element will be replaced by standard output of the command specified in this variable. Content of theGBT_CAR_CUSTOM_TEXT_TEXTvariable takes precedence over this variable.# Show 1 minute loadavg as the content of the Text element export GBT_CAR_CUSTOM_TEXT_CMD="uptime | sed -e 's/.*load average: //' -e 's/,.*//'"
-
GBT_CAR_CUSTOM_TEXT_EXECUTOR='sh'Executor used to execute all text command (
_TEXT_CMD). -
GBT_CAR_CUSTOM_TEXT_EXECUTOR='-c'Parameter for the executor used to execute text command (
_TEXT_CMD). -
GBT_CAR_CUSTOM_DISPLAY='1'Whether to display this car if it's in the list of cars (
GBT_CARS). -
GBT_CAR_CUSTOM_DISPLAY_CMDCommand which gets executed in order to evaluate whether the car should be displayed or not. Content of the
GBT_CAR_CUSTOM_DISPLAYvariable takes precedence over this variable. -
GBT_CAR_CUSTOM_DISPLAY_EXECUTOR='sh'Executor used to execute all display command (
_TEXT_CMD). -
GBT_CAR_CUSTOM_DISPLAY_EXECUTOR='-c'Parameter for the executor used to execute display command (
_TEXT_CMD).# Show percentage of used disk space of the root partition export GBT_CAR_CUSTOM_TEXT_CMD="df -h --output=pcent / | tail -n1 | sed -re 's/\s//g' -e 's/%/%%/'" # Display the car only if the percentage is above 90% export GBT_CAR_CUSTOM_DISPLAY_CMD="[[ $(df -h --output=pcent / | tail -n1 | sed -re 's/\s//g' -e 's/%//') -gt 70 ]] && echo YES"
-
GBT_CAR_CUSTOM_WRAP='0'Whether to wrap the prompt line in front of this car.
-
GBT_CAR_CUSTOM_EXECUTOR='sh'Executor used to execute all custom commands (
_TEXT_CMDand_DISPLAY_CMD). -
GBT_CAR_CUSTOM_EXECUTOR='-c'Parameter for the executor used to execute all custom commands (
_TEXT_CMDand_DISPLAY_CMD). -
GBT_CAR_CUSTOM_SEP_TEXTText content of the separator for this car.
-
GBT_CAR_CUSTOM_SEP_BGBackground color of the separator for this car.
-
GBT_CAR_CUSTOM_SEP_FGForeground color of the separator for this car.
-
GBT_CAR_CUSTOM_SEP_FMFormatting of the separator for this car.
Multiple Custom cars can be used in the GBT_CARS variable. Just add some
identifier behind the car name. To set properties of the new car, just add the
same identifier into the environment variable:
# Adding Custom and Custom1 car
export GBT_CARS='Status, Os, Custom, Custom1, Hostname, Dir, Git, Sign'
# The text of the default Custom car
export GBT_CAR_CUSTOM_TEXT_TEXT='default'
# The text of the Custom1 car
export GBT_CAR_CUSTOM1_TEXT_TEXT='1'
# Set different background color for the Custom1 car
export GBT_CAR_CUSTOM1_BG='magenta'Car that displays current directory name.
-
GBT_CAR_DIR_BG='blue'Background color of the car.
-
GBT_CAR_DIR_FG='light_gray'Foreground color of the car.
-
GBT_CAR_DIR_FM='none'Formatting of the car.
-
GBT_CAR_DIR_FORMAT=' {{ Dir }} 'Format of the car.
-
GBT_CAR_DIR_DIR_BGBackground color of the
{{ Dir }}element. -
GBT_CAR_DIR_DIR_FGForeground color of the
{{ Dir }}element. -
GBT_CAR_DIR_DIR_FMFormatting of the
{{ Dir }}element. -
GBT_CAR_DIR_DIR_TEXTText content of the
{{ Dir }}element. The directory name. -
GBT_CAR_DIR_DIRSEPOS-default character used to separate directories.
-
GBT_CAR_DIR_HOMESIGN='~'Character which represents the user's home directory. If set to empty string, full home directory path is used instead.
-
GBT_CAR_DIR_DEPTH='1'Number of directories to show.
-
GBT_CAR_DIR_NONCURLEN='255'Indicates how many characters of the non-current directory name should be displayed. This can be set to
1to display only the first character of the directory name when usingGBT_CAR_DIR_DEPTHwith value grater than one. -
GBT_CAR_DIR_DISPLAY='1'Whether to display this car if it's in the list of cars (
GBT_CARS). -
GBT_CAR_DIR_WRAP='0'Whether to wrap the prompt line in front of this car.
-
GBT_CAR_DIR_SEP_TEXTText content of the separator for this car.
-
GBT_CAR_DIR_SEP_BGBackground color of the separator for this car.
-
GBT_CAR_DIR_SEP_FGForeground color of the separator for this car.
-
GBT_CAR_DIR_SEP_FMFormatting of the separator for this car.
Car that displays how long each shell command run.
-
GBT_CAR_EXECTIME_BG='light_gray'Background color of the car.
-
GBT_CAR_EXECTIME_FG='black'Foreground color of the car.
-
GBT_CAR_EXECTIME_FM='none'Formatting of the car.
-
GBT_CAR_EXECTIME_FORMAT=' {{ Time }} 'Format of the car.
-
GBT_CAR_EXECTIME_DURATION_BGBackground color of the
{{ Duration }}element. -
GBT_CAR_EXECTIME_DURATION_FGForeground color of the
{{ Duration }}element. -
GBT_CAR_EXECTIME_DURATION_FMFormatting of the
{{ Duration }}element. -
GBT_CAR_EXECTIME_DURATION_TEXTText content of the
{{ Duration }}element. The duration of the execution time (e.g1h8m19s135msfor precision set to3). -
GBT_CAR_EXECTIME_SECONDS_BGBackground color of the
{{ Seconds }}element. -
GBT_CAR_EXECTIME_SECONDS_FGForeground color of the
{{ Seconds }}element. -
GBT_CAR_EXECTIME_SECONDS_FMFormatting of the
{{ Seconds }}element. -
GBT_CAR_EXECTIME_SECONDS_TEXTText content of the
{{ Seconds }}element. The execution time in seconds (e.g.4099.1358for precision set to4). -
GBT_CAR_EXECTIME_TIME_BGBackground color of the
{{ Time }}element. -
GBT_CAR_EXECTIME_TIME_FGForeground color of the
{{ Time }}element. -
GBT_CAR_EXECTIME_TIME_FMFormatting of the
{{ Time }}element. -
GBT_CAR_EXECTIME_TIME_TEXTText content of the
{{ Time }}element. The execution time (e.g.01:08:19.1358for precision set to4). -
GBT_CAR_EXECTIME_PRECISION='0'Sub-second precision to show.
-
GBT_CAR_EXECTIME_SECSThe number of seconds the command run in shell. This variable is defined in the source file as shown bellow.
-
GBT_CAR_EXECTIME_BELL='0'Sound console bell if the executed command exceeds specified number of seconds. Value set to
0disables the bell (default). -
GBT_CAR_EXECTIME_DISPLAY='1'Whether to display this car if it's in the list of cars (
GBT_CARS). -
GBT_CAR_EXECTIME_WRAP='0'Whether to wrap the prompt line in front of this car.
-
GBT_CAR_EXECTIME_SEP_TEXTText content of the separator for this car.
-
GBT_CAR_EXECTIME_SEP_BGBackground color of the separator for this car.
-
GBT_CAR_EXECTIME_SEP_FGForeground color of the separator for this car.
-
GBT_CAR_EXECTIME_SEP_FMFormatting of the separator for this car.
In order to allow this car to calculate the execution time, the following must be loaded in the shell:
# For Bash
source /usr/share/gbt/sources/exectime/bash.sh
# For ZSH
source /usr/share/gbt/sources/exectime/zsh.shOn macOS the date command does not support %N format for milliseconds and
you need to override the environment variable GBT__SOURCE_DATE_ARG='+%s.
Car that displays information about the local GCP configuration.
-
GBT_CAR_GCP_BG='33'Background color of the car.
-
GBT_CAR_GCP_FG='white'Foreground color of the car.
-
GBT_CAR_GCP_FM='none'Formatting of the car.
-
GBT_CAR_GCP_FORMAT=' {{ Icon }} {{ Project }} 'Format of the car.
-
GBT_CAR_GCP_ICON_BGBackground color of the
{{ Icon }}element. -
GBT_CAR_GCP_ICON_FGForeground color of the
{{ Icon }}element. -
GBT_CAR_GCP_ICON_FMFormatting of the
{{ Icon }}element. -
GBT_CAR_GCP_ICON_TEXT=''Text content of the
{{ Icon }}element. -
GBT_CAR_GCP_ACCOUNT_BGBackground color of the
{{ Account }}element. -
GBT_CAR_GCP_ACCOUNT_FGForeground color of the
{{ Account }}element. -
GBT_CAR_GCP_ACCOUNT_FMFormatting of the
{{ Account }}element. -
GBT_CAR_GCP_ACCOUNT_TEXTText content of the
{{ Account }}element specifying the configured account. -
GBT_CAR_GCP_CONFIG_BGBackground color of the
{{ Config }}element. -
GBT_CAR_GCP_CONFIG_FGForeground color of the
{{ Config }}element. -
GBT_CAR_GCP_CONFIG_FMFormatting of the
{{ Config }}element. -
GBT_CAR_GCP_CONFIG_TEXTText content of the
{{ Config }}element specifying the active configuration. -
GBT_CAR_GCP_PROJECT_BGBackground color of the
{{ Project }}element. -
GBT_CAR_GCP_PROJECT_FGForeground color of the
{{ Project }}element. -
GBT_CAR_GCP_PROJECT_FMFormatting of the
{{ Project }}element. -
GBT_CAR_GCP_PROJECT_TEXTText content of the
{{ Project }}element specifying the configured project. -
GBT_CAR_GCP_PROJECT_ALIASESList of aliases that allow to display different project name based on the original name. The following example shows how to change the project
my-dev-project-123456todevand the projectmy-prod-project-654321toprod.export GBT_CAR_GCP_PROJECT_ALIASES=' my-dev-project-123456=dev, my-prod-project-654321=prod, '
-
GBT_CAR_GCP_DISPLAYWhether to display this car if it's in the list of cars (
GBT_CARS). -
GBT_CAR_GCP_WRAP='0'Whether to wrap the prompt line in front of this car.
-
GBT_CAR_GCP_SEP_TEXTText content of the separator for this car.
-
GBT_CAR_GCP_SEP_BGBackground color of the separator for this car.
-
GBT_CAR_GCP_SEP_FGForeground color of the separator for this car.
-
GBT_CAR_GCP_SEP_FMFormatting of the separator for this car.
Car that displays information about a local Git repository. This car is displayed only if the current directory is a Git repository.
-
GBT_CAR_GIT_BG='light_gray'Background color of the car.
-
GBT_CAR_GIT_FG='black'Foreground color of the car.
-
GBT_CAR_GIT_FM='none'Formatting of the car.
-
GBT_CAR_GIT_FORMAT=' {{ Icon }} {{ Head }} {{ Status }}{{ Ahead }}{{ Behind }} 'Format of the car.
-
GBT_CAR_GIT_ICON_BGBackground color of the
{{ Icon }}element. -
GBT_CAR_GIT_ICON_FGForeground color of the
{{ Icon }}element. -
GBT_CAR_GIT_ICON_FMFormatting of the
{{ Icon }}element. -
GBT_CAR_GIT_ICON_TEXT=''Text content of the
{{ Icon }}element. -
GBT_CAR_GIT_HEAD_BGBackground color of the
{{ Head }}element. -
GBT_CAR_GIT_HEAD_FGForeground color of the
{{ Head }}element. -
GBT_CAR_GIT_HEAD_FMFormatting of the
{{ Head }}element. -
GBT_CAR_GIT_HEAD_TEXTText content of the
{{ Head }}element - branch, tag name or the commit ID. -
GBT_CAR_GIT_STATUS_BGBackground color of the
{{ Status }}element. -
GBT_CAR_GIT_STATUS_FGForeground color of the
{{ Status }}element. -
GBT_CAR_GIT_STATUS_FMFormatting of the
{{ Status }}element. -
GBT_CAR_GIT_STATUS_FORMATFormat of the
{{ Status }}element. The content is either{{ StatusDirty }}or{{ StatusClean }}depending on the state of the local Git repository. -
GBT_CAR_GIT_STATUS_DIRTY_BGBackground color of the
{{ StatusDirty }}element. -
GBT_CAR_GIT_STATUS_DIRTY_FG='red'Foreground color of the
{{ StatusDirty }}element. -
GBT_CAR_GIT_STATUS_DIRTY_FMFormatting of the
{{ StatusDirty }}element. -
GBT_CAR_GIT_STATUS_DIRTY_TEXT='✘'Text content of the
{{ StatusDirty }}element. -
GBT_CAR_GIT_STATUS_CLEAN_BGBackground color of the
{{ StatusClean }}element. -
GBT_CAR_GIT_STATUS_CLEAN_FG='green'Foreground color of the
{{ StatusClean }}element. -
GBT_CAR_GIT_STATUS_CLEAN_FMFormatting of the
{{ StatusClean }}element. -
GBT_CAR_GIT_STATUS_CLEAN_TEXT='✔'Text content of the
{{ StatusClean }}element. -
GBT_CAR_GIT_STATUS_ADDED_BGBackground color of the
{{ StatusAdded }}element. -
GBT_CAR_GIT_STATUS_ADDED_FGForeground color of the
{{ StatusAdded }}element. -
GBT_CAR_GIT_STATUS_ADDED_FMFormatting of the
{{ StatusAdded }}element. -
GBT_CAR_GIT_STATUS_ADDED_FORMAT='{{ StatusAddedSymbol }}'Format of the the
{{ StatusAdded }}element. It can be{{ StatusAddedSymbol }}or{{ StatusAddedCount }}. -
GBT_CAR_GIT_STATUS_ADDED_SYMBOL_BGBackground color of the
{{ StatusAddedSymbol }}element. -
GBT_CAR_GIT_STATUS_ADDED_SYMBOL_FGForeground color of the
{{ StatusAddedSymbol }}element. -
GBT_CAR_GIT_STATUS_ADDED_SYMBOL_FMFormatting of the
{{ StatusAddedSymbol }}element. -
GBT_CAR_GIT_STATUS_ADDED_SYMBOL_TEXT=' ⟴'Text content of the
{{ StatusAddedSymbol }}element. -
GBT_CAR_GIT_STATUS_ADDED_COUNT_BGBackground color of the
{{ StatusAddedCount }}element. -
GBT_CAR_GIT_STATUS_ADDED_COUNT_FGForeground color of the
{{ StatusAddedCount }}element. -
GBT_CAR_GIT_STATUS_ADDED_COUNT_FMFormatting of the
{{ StatusAddedSymbol }}element. -
GBT_CAR_GIT_STATUS_ADDED_COUNT_TEXTText content of the
{{ StatusAddedCount }}element. By default it contains a number of added files. -
GBT_CAR_GIT_STATUS_COPIED_BGBackground color of the
{{ StatusCopied }}element. -
GBT_CAR_GIT_STATUS_COPIED_FGForeground color of the
{{ StatusCopied }}element. -
GBT_CAR_GIT_STATUS_COPIED_FMFormatting of the
{{ StatusCopied }}element. -
GBT_CAR_GIT_STATUS_COPIED_FORMAT='{{ StatusCopiedSymbol }}'Format of the the
{{ StatusCopied }}element. It can be{{ StatusCopiedSymbol }}or{{ StatusCopiedCount }}. -
GBT_CAR_GIT_STATUS_COPIED_SYMBOL_BGBackground color of the
{{ StatusCopiedSymbol }}element. -
GBT_CAR_GIT_STATUS_COPIED_SYMBOL_FGForeground color of the
{{ StatusCopiedSymbol }}element. -
GBT_CAR_GIT_STATUS_COPIED_SYMBOL_FMFormatting of the
{{ StatusCopiedSymbol }}element. -
GBT_CAR_GIT_STATUS_COPIED_SYMBOL_TEXT=' ⥈'Text content of the
{{ StatusCopiedSymbol }}element. -
GBT_CAR_GIT_STATUS_COPIED_COUNT_BGBackground color of the
{{ StatusCopiedCount }}element. -
GBT_CAR_GIT_STATUS_COPIED_COUNT_FGForeground color of the
{{ StatusCopiedCount }}element. -
GBT_CAR_GIT_STATUS_COPIED_COUNT_FMFormatting of the
{{ StatusCopiedSymbol }}element. -
GBT_CAR_GIT_STATUS_COPIED_COUNT_TEXTText content of the
{{ StatusCopiedCount }}element. By default it contains a number of files copied. -
GBT_CAR_GIT_STATUS_DELETED_BGBackground color of the
{{ StatusDeleted }}element. -
GBT_CAR_GIT_STATUS_DELETED_FGForeground color of the
{{ StatusDeleted }}element. -
GBT_CAR_GIT_STATUS_DELETED_FMFormatting of the
{{ StatusDeleted }}element. -
GBT_CAR_GIT_STATUS_DELETED_FORMAT='{{ StatusDeletedSymbol }}'Format of the the
{{ StatusDeleted }}element. It can be{{ StatusDeletedSymbol }}or{{ StatusDeletedCount }}. -
GBT_CAR_GIT_STATUS_DELETED_SYMBOL_BGBackground color of the
{{ StatusDeletedSymbol }}element. -
GBT_CAR_GIT_STATUS_DELETED_SYMBOL_FGForeground color of the
{{ StatusDeletedSymbol }}element. -
GBT_CAR_GIT_STATUS_DELETED_SYMBOL_FMFormatting of the
{{ StatusDeletedSymbol }}element. -
GBT_CAR_GIT_STATUS_DELETED_SYMBOL_TEXT=' ➖'Text content of the
{{ StatusDeletedSymbol }}element. -
GBT_CAR_GIT_STATUS_DELETED_COUNT_BGBackground color of the
{{ StatusDeletedCount }}element. -
GBT_CAR_GIT_STATUS_DELETED_COUNT_FGForeground color of the
{{ StatusDeletedCount }}element. -
GBT_CAR_GIT_STATUS_DELETED_COUNT_FMFormatting of the
{{ StatusDeletedSymbol }}element. -
GBT_CAR_GIT_STATUS_DELETED_COUNT_TEXTText content of the
{{ StatusDeletedCount }}element. By default it contains a number of deleted files. -
GBT_CAR_GIT_STATUS_IGNORED_BGBackground color of the
{{ StatusIgnored }}element. -
GBT_CAR_GIT_STATUS_IGNORED_FGForeground color of the
{{ StatusIgnored }}element. -
GBT_CAR_GIT_STATUS_IGNORED_FMFormatting of the
{{ StatusIgnored }}element. -
GBT_CAR_GIT_STATUS_IGNORED_FORMAT='{{ StatusIgnoredSymbol }}'Format of the the
{{ StatusIgnored }}element. It can be{{ StatusIgnoredSymbol }}or{{ StatusIgnoredCount }}. -
GBT_CAR_GIT_STATUS_IGNORED_SYMBOL_BGBackground color of the
{{ StatusIgnoredSymbol }}element. -
GBT_CAR_GIT_STATUS_IGNORED_SYMBOL_FGForeground color of the
{{ StatusIgnoredSymbol }}element. -
GBT_CAR_GIT_STATUS_IGNORED_SYMBOL_FMFormatting of the
{{ StatusIgnoredSymbol }}element. -
GBT_CAR_GIT_STATUS_IGNORED_SYMBOL_TEXT=' ⬆'Text content of the
{{ StatusIgnoredSymbol }}element. -
GBT_CAR_GIT_STATUS_IGNORED_COUNT_BGBackground color of the
{{ StatusIgnoredCount }}element. -
GBT_CAR_GIT_STATUS_IGNORED_COUNT_FGForeground color of the
{{ StatusIgnoredCount }}element. -
GBT_CAR_GIT_STATUS_IGNORED_COUNT_FMFormatting of the
{{ StatusIgnoredSymbol }}element. -
GBT_CAR_GIT_STATUS_IGNORED_COUNT_TEXTText content of the
{{ StatusIgnoredCount }}element. By default it contains a number of ignored files. -
GBT_CAR_GIT_STATUS_MODIFIED_BGBackground color of the
{{ StatusModified }}element. -
GBT_CAR_GIT_STATUS_MODIFIED_FGForeground color of the
{{ StatusModified }}element. -
GBT_CAR_GIT_STATUS_MODIFIED_FMFormatting of the
{{ StatusModified }}element. -
GBT_CAR_GIT_STATUS_MODIFIED_FORMAT='{{ StatusModifiedSymbol }}'Format of the the
{{ StatusModified }}element. It can be{{ StatusModifiedSymbol }}or{{ StatusModifiedCount }}. -
GBT_CAR_GIT_STATUS_MODIFIED_SYMBOL_BGBackground color of the
{{ StatusModifiedSymbol }}element. -
GBT_CAR_GIT_STATUS_MODIFIED_SYMBOL_FGForeground color of the
{{ StatusModifiedSymbol }}element. -
GBT_CAR_GIT_STATUS_MODIFIED_SYMBOL_FMFormatting of the
{{ StatusModifiedSymbol }}element. -
GBT_CAR_GIT_STATUS_MODIFIED_SYMBOL_TEXT=' ⬆'Text content of the
{{ StatusModifiedSymbol }}element. -
GBT_CAR_GIT_STATUS_MODIFIED_COUNT_BGBackground color of the
{{ StatusModifiedCount }}element. -
GBT_CAR_GIT_STATUS_MODIFIED_COUNT_FGForeground color of the
{{ StatusModifiedCount }}element. -
GBT_CAR_GIT_STATUS_MODIFIED_COUNT_FMFormatting of the
{{ StatusModifiedSymbol }}element. -
GBT_CAR_GIT_STATUS_MODIFIED_COUNT_TEXTText content of the
{{ StatusModifiedCount }}element. By default it contains a number of modified files. -
GBT_CAR_GIT_STATUS_RENAMED_BGBackground color of the
{{ StatusRenamed }}element. -
GBT_CAR_GIT_STATUS_RENAMED_FGForeground color of the
{{ StatusRenamed }}element. -
GBT_CAR_GIT_STATUS_RENAMED_FMFormatting of the
{{ StatusRenamed }}element. -
GBT_CAR_GIT_STATUS_RENAMED_FORMAT='{{ StatusRenamedSymbol }}'Format of the the
{{ StatusRenamed }}element. It can be{{ StatusRenamedSymbol }}or{{ StatusRenamedCount }}. -
GBT_CAR_GIT_STATUS_RENAMED_SYMBOL_BGBackground color of the
{{ StatusRenamedSymbol }}element. -
GBT_CAR_GIT_STATUS_RENAMED_SYMBOL_FGForeground color of the
{{ StatusRenamedSymbol }}element. -
GBT_CAR_GIT_STATUS_RENAMED_SYMBOL_FMFormatting of the
{{ StatusRenamedSymbol }}element. -
GBT_CAR_GIT_STATUS_RENAMED_SYMBOL_TEXT=' ⬆'Text content of the
{{ StatusRenamedSymbol }}element. -
GBT_CAR_GIT_STATUS_RENAMED_COUNT_BGBackground color of the
{{ StatusRenamedCount }}element. -
GBT_CAR_GIT_STATUS_RENAMED_COUNT_FGForeground color of the
{{ StatusRenamedCount }}element. -
GBT_CAR_GIT_STATUS_RENAMED_COUNT_FMFormatting of the
{{ StatusRenamedSymbol }}element. -
GBT_CAR_GIT_STATUS_RENAMED_COUNT_TEXTText content of the
{{ StatusRenamedCount }}element. By default it contains a number of renamed files. -
GBT_CAR_GIT_STATUS_STAGED_BGBackground color of the
{{ StatusStaged }}element. -
GBT_CAR_GIT_STATUS_STAGED_FGForeground color of the
{{ StatusStaged }}element. -
GBT_CAR_GIT_STATUS_STAGED_FMFormatting of the
{{ StatusStaged }}element. -
GBT_CAR_GIT_STATUS_STAGED_FORMAT='{{ StatusStagedSymbol }}'Format of the the
{{ StatusStaged }}element. It can be{{ StatusStagedSymbol }}or{{ StatusStagedCount }}. -
GBT_CAR_GIT_STATUS_STAGED_SYMBOL_BGBackground color of the
{{ StatusStagedSymbol }}element. -
GBT_CAR_GIT_STATUS_STAGED_SYMBOL_FGForeground color of the
{{ StatusStagedSymbol }}element. -
GBT_CAR_GIT_STATUS_STAGED_SYMBOL_FMFormatting of the
{{ StatusStagedSymbol }}element. -
GBT_CAR_GIT_STATUS_STAGED_SYMBOL_TEXT=' ⬆'Text content of the
{{ StatusStagedSymbol }}element. -
GBT_CAR_GIT_STATUS_STAGED_COUNT_BGBackground color of the
{{ StatusStagedCount }}element. -
GBT_CAR_GIT_STATUS_STAGED_COUNT_FGForeground color of the
{{ StatusStagedCount }}element. -
GBT_CAR_GIT_STATUS_STAGED_COUNT_FMFormatting of the
{{ StatusStagedSymbol }}element. -
GBT_CAR_GIT_STATUS_STAGED_COUNT_TEXTText content of the
{{ StatusStagedCount }}element. By default it contains a number of staged files. -
GBT_CAR_GIT_STATUS_UNMERGED_BGBackground color of the
{{ StatusUnmerged }}element. -
GBT_CAR_GIT_STATUS_UNMERGED_FGForeground color of the
{{ StatusUnmerged }}element. -
GBT_CAR_GIT_STATUS_UNMERGED_FMFormatting of the
{{ StatusUnmerged }}element. -
GBT_CAR_GIT_STATUS_UNMERGED_FORMAT='{{ StatusUnmergedSymbol }}'Format of the the
{{ StatusUnmerged }}element. It can be{{ StatusUnmergedSymbol }}or{{ StatusUnmergedCount }}. -
GBT_CAR_GIT_STATUS_UNMERGED_SYMBOL_BGBackground color of the
{{ StatusUnmergedSymbol }}element. -
GBT_CAR_GIT_STATUS_UNMERGED_SYMBOL_FGForeground color of the
{{ StatusUnmergedSymbol }}element. -
GBT_CAR_GIT_STATUS_UNMERGED_SYMBOL_FMFormatting of the
{{ StatusUnmergedSymbol }}element. -
GBT_CAR_GIT_STATUS_UNMERGED_SYMBOL_TEXT=' ⬆'Text content of the
{{ StatusUnmergedSymbol }}element. -
GBT_CAR_GIT_STATUS_UNMERGED_COUNT_BGBackground color of the
{{ StatusUnmergedCount }}element. -
GBT_CAR_GIT_STATUS_UNMERGED_COUNT_FGForeground color of the
{{ StatusUnmergedCount }}element. -
GBT_CAR_GIT_STATUS_UNMERGED_COUNT_FMFormatting of the
{{ StatusUnmergedSymbol }}element. -
GBT_CAR_GIT_STATUS_UNMERGED_COUNT_TEXTText content of the
{{ StatusUnmergedCount }}element. By default it contains a number of unmerged files. -
GBT_CAR_GIT_STATUS_UNTRACKED_BGBackground color of the
{{ StatusUntracked }}element. -
GBT_CAR_GIT_STATUS_UNTRACKED_FGForeground color of the
{{ StatusUntracked }}element. -
GBT_CAR_GIT_STATUS_UNTRACKED_FMFormatting of the
{{ StatusUntracked }}element. -
GBT_CAR_GIT_STATUS_UNTRACKED_FORMAT='{{ StatusUntrackedSymbol }}'Format of the the
{{ StatusUntracked }}element. It can be{{ StatusUntrackedSymbol }}or{{ StatusUntrackedCount }}. -
GBT_CAR_GIT_STATUS_UNTRACKED_SYMBOL_BGBackground color of the
{{ StatusUntrackedSymbol }}element. -
GBT_CAR_GIT_STATUS_UNTRACKED_SYMBOL_FGForeground color of the
{{ StatusUntrackedSymbol }}element. -
GBT_CAR_GIT_STATUS_UNTRACKED_SYMBOL_FMFormatting of the
{{ StatusUntrackedSymbol }}element. -
GBT_CAR_GIT_STATUS_UNTRACKED_SYMBOL_TEXT=' ⬆'Text content of the
{{ StatusUntrackedSymbol }}element. -
GBT_CAR_GIT_STATUS_UNTRACKED_COUNT_BGBackground color of the
{{ StatusUntrackedCount }}element. -
GBT_CAR_GIT_STATUS_UNTRACKED_COUNT_FGForeground color of the
{{ StatusUntrackedCount }}element. -
GBT_CAR_GIT_STATUS_UNTRACKED_COUNT_FMFormatting of the
{{ StatusUntrackedSymbol }}element. -
GBT_CAR_GIT_STATUS_UNTRACKED_COUNT_TEXTText content of the
{{ StatusUntrackedCount }}element. By default it contains a number of untracked files. -
GBT_CAR_GIT_AHEAD_BGBackground color of the
{{ Ahead }}element. -
GBT_CAR_GIT_AHEAD_FGForeground color of the
{{ Ahead }}element. -
GBT_CAR_GIT_AHEAD_FMFormatting of the
{{ Ahead }}element. -
GBT_CAR_GIT_AHEAD_FORMAT='{{ AheadSymbol }}'Format of the the
{{ Ahead }}element. It can be{{ AheadSymbol }}or{{ AheadCount }}. -
GBT_CAR_GIT_AHEAD_SYMBOL_BGBackground color of the
{{ AheadSymbol }}element. -
GBT_CAR_GIT_AHEAD_SYMBOL_FGForeground color of the
{{ AheadSymbol }}element. -
GBT_CAR_GIT_AHEAD_SYMBOL_FMFormatting of the
{{ AheadSymbol }}element. -
GBT_CAR_GIT_AHEAD_SYMBOL_TEXT=' ⬆'Text content of the
{{ AheadSymbol }}element. -
GBT_CAR_GIT_AHEAD_COUNT_BGBackground color of the
{{ AheadCount }}element. -
GBT_CAR_GIT_AHEAD_COUNT_FGForeground color of the
{{ AheadCount }}element. -
GBT_CAR_GIT_AHEAD_COUNT_FMFormatting of the
{{ AheadSymbol }}element. -
GBT_CAR_GIT_AHEAD_COUNT_TEXTText content of the
{{ AheadCount }}element. By default it contains a number of commits ahead of the remote branch. -
GBT_CAR_GIT_BEHIND_BGBackground color of the
{{ Behind }}element. -
GBT_CAR_GIT_BEHIND_FGForeground color of the
{{ Behind }}element. -
GBT_CAR_GIT_BEHIND_FMFormatting of the
{{ Behind }}element. -
GBT_CAR_GIT_BEHIND_FORMAT='{{ BehindSymbol }}'Format of the the
{{ Behind }}element. It can be{{ BehindSymbol }}or{{ BehindCount }}. -
GBT_CAR_GIT_BEHIND_SYMBOL_BGBackground color of the
{{ BehindSymbol }}element. -
GBT_CAR_GIT_BEHIND_SYMBOL_FGForeground color of the
{{ BehindSymbol }}element. -
GBT_CAR_GIT_BEHIND_SYMBOL_FMFormatting of the
{{ BehindSymbol }}element. -
GBT_CAR_GIT_BEHIND_SYMBOL_TEXT=' ⬇'Text content of the
{{ BehindSymbol }}element. -
GBT_CAR_GIT_BEHIND_COUNT_BGBackground color of the
{{ BehindCount }}element. -
GBT_CAR_GIT_BEHIND_COUNT_FGForeground color of the
{{ BehindCount }}element. -
GBT_CAR_GIT_BEHIND_COUNT_FMFormatting of the
{{ BehindSymbol }}element. -
GBT_CAR_GIT_BEHIND_COUNT_TEXTText content of the
{{ BehindCount }}element. By default it contains a number of commits ahead of the remote branch. -
GBT_CAR_GIT_STASH_BGBackground color of the
{{ Stash }}element. -
GBT_CAR_GIT_STASH_FGForeground color of the
{{ Stash }}element. -
GBT_CAR_GIT_STASH_FMFormatting of the
{{ Stash }}element. -
GBT_CAR_GIT_STASH_FORMAT='{{ StashSymbol }}'Format of the the
{{ Stash }}element. It can be{{ StashSymbol }}or{{ StashCount }}. -
GBT_CAR_GIT_STASH_SYMBOL_BGBackground color of the
{{ StashSymbol }}element. -
GBT_CAR_GIT_STASH_SYMBOL_FGForeground color of the
{{ StashSymbol }}element. -
GBT_CAR_GIT_STASH_SYMBOL_FMFormatting of the
{{ StashSymbol }}element. -
GBT_CAR_GIT_STASH_SYMBOL_TEXT=' ⚑'Text content of the
{{ StashSymbol }}element. -
GBT_CAR_GIT_STASH_COUNT_BGBackground color of the
{{ StashCount }}element. -
GBT_CAR_GIT_STASH_COUNT_FGForeground color of the
{{ StashCount }}element. -
GBT_CAR_GIT_STASH_COUNT_FMFormatting of the
{{ StashSymbol }}element. -
GBT_CAR_GIT_STASH_COUNT_TEXTText content of the
{{ StashCount }}element. By default it contains a number of stashes. -
GBT_CAR_GIT_DISPLAYWhether to display this car if it's in the list of cars (
GBT_CARS). -
GBT_CAR_GIT_WRAP='0'Whether to wrap the prompt line in front of this car.
-
GBT_CAR_GIT_SEP_TEXTText content of the separator for this car.
-
GBT_CAR_GIT_SEP_BGBackground color of the separator for this car.
-
GBT_CAR_GIT_SEP_FGForeground color of the separator for this car.
-
GBT_CAR_GIT_SEP_FMFormatting of the separator for this car.
Car that displays username of the currently logged user and the hostname of the local machine.
-
GBT_CAR_HOSTNAME_BG='dark_gray'Background color of the car.
-
GBT_CAR_HOSTNAME_FG='252'Foreground color of the car.
-
GBT_CAR_HOSTNAME_FM='none'Formatting of the car.
-
GBT_CAR_HOSTNAME_FORMAT=' {{ UserHost }} 'Format of the car.
-
GBT_CAR_HOSTNAME_USERHOST_BGBackground color of the
{{ UserHost }}element. -
GBT_CAR_HOSTNAME_USERHOST_FGForeground color of the
{{ UserHost }}element. -
GBT_CAR_HOSTNAME_USERHOST_FMFormatting of the
{{ UserHost }}element. -
GBT_CAR_HOSTNAME_USERHOST_FORMATFormat of the
{{ UserHost }}element. The value is either{{ Admin }}@{{ Host }}if the user isrootor{{ User }}@{{ Host }}if the user is a normal user. -
GBT_CAR_HOSTNAME_ADMIN_BGBackground color of the
{{ Admin }}element. -
GBT_CAR_HOSTNAME_ADMIN_FGForeground color of the
{{ Admin }}element. -
GBT_CAR_HOSTNAME_ADMIN_FMFormatting of the
{{ Admin }}element. -
GBT_CAR_HOSTNAME_ADMIN_TEXTText content of the
{{ Admin }}element. The user name. -
GBT_CAR_HOSTNAME_USER_BGBackground color of the
{{ User }}element. -
GBT_CAR_HOSTNAME_USER_FGForeground color of the
{{ User }}element. -
GBT_CAR_HOSTNAME_USER_FMFormatting of the
{{ User }}element. -
GBT_CAR_HOSTNAME_USER_TEXTText content of the
{{ User }}element. The user name. -
GBT_CAR_HOSTNAME_HOST_BGBackground color of the
{{ Host }}element. -
GBT_CAR_HOSTNAME_HOST_FGForeground color of the
{{ Host }}element. -
GBT_CAR_HOSTNAME_HOST_FMFormatting of the
{{ Host }}element. -
GBT_CAR_HOSTNAME_HOST_TEXTText content of the
{{ Host }}element. The host name. -
GBT_CAR_HOSTNAME_DISPLAY='1'Whether to display this car if it's in the list of cars (
GBT_CARS). -
GBT_CAR_HOSTNAME_WRAP='0'Whether to wrap the prompt line in front of this car.
-
GBT_CAR_HOSTNAME_SEP_TEXTText content of the separator for this car.
-
GBT_CAR_HOSTNAME_SEP_BGBackground color of the separator for this car.
-
GBT_CAR_HOSTNAME_SEP_FGForeground color of the separator for this car.
-
GBT_CAR_HOSTNAME_SEP_FMFormatting of the separator for this car.
Car that displays kubectl information.
-
GBT_CAR_KUBECTL_BG='26'Background color of the car.
-
GBT_CAR_KUBECTL_FG='white'Foreground color of the car.
-
GBT_CAR_KUBECTL_FM='none'Formatting of the car.
-
GBT_CAR_KUBECTL_FORMAT=' {{ Icon }} {{ Context }} 'Format of the car.
{{ Cluster }},{{ AuthInfo }}and{{ Namespace }}can be used here as well. -
GBT_CAR_KUBECTL_ICON_BGBackground color of the
{{ Icon }}element. -
GBT_CAR_KUBECTL_ICON_FGForeground color of the
{{ Icon }}element. -
GBT_CAR_KUBECTL_ICON_FMFormatting of the
{{ Icon }}element. -
GBT_CAR_KUBECTL_ICON_TEXT='⎈'Text content of the
{{ Icon }}element. -
GBT_CAR_KUBECTL_CONTEXT_BGBackground color of the
{{ Context }}element. -
GBT_CAR_KUBECTL_CONTEXT_FGForeground color of the
{{ Context }}element. -
GBT_CAR_KUBECTL_CONTEXT_FMFormatting of the
{{ Context }}element. -
GBT_CAR_KUBECTL_CONTEXT_TEXTText content of the
{{ Context }}element. -
GBT_CAR_KUBECTL_CLUSTER_BGBackground color of the
{{ Cluster }}element. -
GBT_CAR_KUBECTL_CLUSTER_FGForeground color of the
{{ Cluster }}element. -
GBT_CAR_KUBECTL_CLUSTER_FMFormatting of the
{{ Cluster }}element. -
GBT_CAR_KUBECTL_CLUSTER_TEXTText content of the
{{ Cluster }}element. -
GBT_CAR_KUBECTL_AUTHINFO_BGBackground color of the
{{ AuthInfo }}element. -
GBT_CAR_KUBECTL_AUTHINFO_FGForeground color of the
{{ AuthInfo }}element. -
GBT_CAR_KUBECTL_AUTHINFO_FMFormatting of the
{{ AuthInfo }}element. -
GBT_CAR_KUBECTL_AUTHINFO_TEXTText content of the
{{ AuthInfo }}element. -
GBT_CAR_KUBECTL_NAMESPACE_BGBackground color of the
{{ Namespace }}element. -
GBT_CAR_KUBECTL_NAMESPACE_FGForeground color of the
{{ Namespace }}element. -
GBT_CAR_KUBECTL_NAMESPACE_FMFormatting of the
{{ Namespace }}element. -
GBT_CAR_KUBECTL_NAMESPACE_TEXTText content of the
{{ Namespace }}element. -
GBT_CAR_KUBECTL_DISPLAY='1'Whether to display this car if it's in the list of cars (
GBT_CARS). -
GBT_CAR_KUBECTL_WRAP='0'Whether to wrap the prompt line in front of this car.
-
GBT_CAR_KUBECTL_SEP_TEXTText content of the separator for this car.
-
GBT_CAR_KUBECTL_SEP_BGBackground color of the separator for this car.
-
GBT_CAR_KUBECTL_SEP_FGForeground color of the separator for this car.
-
GBT_CAR_KUBECTL_SEP_FMFormatting of the separator for this car.
Car that displays icon of the operating system.
-
GBT_CAR_OS_BG='235'Background color of the car.
-
GBT_CAR_OS_FG='white'Foreground color of the car.
-
GBT_CAR_OS_FM='none'Formatting of the car.
-
GBT_CAR_OS_FORMAT=' {{ Symbol }} 'Format of the car.
-
GBT_CAR_OS_SYMBOL_BGBackground color of the
{{ Symbol }}element. -
GBT_CAR_OS_SYMBOL_FGForeground color of the
{{ Symbol }}element. -
GBT_CAR_OS_SYMBOL_FMFormatting of the
{{ Symbol }}element. -
GBT_CAR_OS_SYMBOL_TEXTText content of the
{{ Symbol }}element. -
GBT_CAR_OS_NAMEThe name of the symbol to display. Default value is selected by the system the shell runs at. Possible names and their symbols are:
amznandroidarcharcharmcentoscloudcoreosdarwindebiandockerelementaryfedorafreebsdgentoolinuxlinuxmintmageiamandrivaopensuseraspbianredhatsabayonslackwareubuntuwindows
Example:
export GBT_CAR_OS_NAME='arch'
-
GBT_CAR_OS_DISPLAY='1'Whether to display this car if it's in the list of cars (
GBT_CARS). -
GBT_CAR_OS_WRAP='0'Whether to wrap the prompt line in front of this car.
-
GBT_CAR_OS_SEP_TEXTText content of the separator for this car.
-
GBT_CAR_OS_SEP_BGBackground color of the separator for this car.
-
GBT_CAR_OS_SEP_FGForeground color of the separator for this car.
-
GBT_CAR_OS_SEP_FMFormatting of the separator for this car.
Car that displays Python Virtual Environment name. This car is displayed only if the Python Virtual Environment is activated. The activation script usually prepends the shell prompt by the Virtual Environment name by default. In order to disable it, the following environment variable must be set:
export VIRTUAL_ENV_DISABLE_PROMPT='1'Variables used by the car:
-
GBT_CAR_PYVIRTENV_BG='222'Background color of the car.
-
GBT_CAR_PYVIRTENV_FG='black'Foreground color of the car.
-
GBT_CAR_PYVIRTENV_FM='none'Formatting of the car.
-
GBT_CAR_PYVIRTENV_FORMAT=' {{ Icon }} {{ Name }} 'Format of the car.
-
GBT_CAR_PYVIRTENV_ICON_BGBackground color of the
{{ Icon }}element. -
GBT_CAR_PYVIRTENV_ICON_FGForeground color of the
{{ Icon }}element. -
GBT_CAR_PYVIRTENV_ICON_FMFormatting of the
{{ Icon }}element. -
GBT_CAR_PYVIRTENV_ICON_TEXTText content of the
{{ Icon }}element. -
GBT_CAR_PYVIRTENV_NAME_BGBackground color of the
{{ Name }}element. -
GBT_CAR_PYVIRTENV_NAME_FG='33'Foreground color of the
{{ NAME }}element. -
GBT_CAR_PYVIRTENV_NAME_FMFormatting of the
{{ Name }}element. -
GBT_CAR_PYVIRTENV_NAME_TEXTThe name of the Python Virtual Environment deducted from the
VIRTUAL_ENVenvironment variable. -
GBT_CAR_PYVIRTENV_DISPLAYWhether to display this car if it's in the list of cars (
GBT_CARS). -
GBT_CAR_PYVIRTENV_WRAP='0'Whether to wrap the prompt line in front of this car.
-
GBT_CAR_PYVIRTENV_SEP_TEXTText content of the separator for this car.
-
GBT_CAR_PYVIRTENV_SEP_BGBackground color of the separator for this car.
-
GBT_CAR_PYVIRTENV_SEP_FGForeground color of the separator for this car.
-
GBT_CAR_PYVIRTENV_SEP_FMFormatting of the separator for this car.
Car that displays prompt character for the admin and user at the end of the train.
-
GBT_CAR_SIGN_BG='default'Background color of the car.
-
GBT_CAR_SIGN_FG='default'Foreground color of the car.
-
GBT_CAR_SIGN_FM='none'Formatting of the car.
-
GBT_CAR_SIGN_FORMAT=' {{ Symbol }} 'Format of the car.
-
GBT_CAR_SIGN_SYMBOL_BGBackground color of the
{{ Symbol }}element. -
GBT_CAR_SIGN_SYMBOL_FGForeground color of the
{{ Symbol }}element. -
GBT_CAR_SIGN_SYMBOL_FM='bold'Formatting of the
{{ Symbol }}element. -
GBT_CAR_SIGN_SYMBOL_FORMATFormat of the
{{ Symbol }}element. The format is either{{ Admin }}if the UID is 0 or{{ User }}if the UID is not 0. -
GBT_CAR_SIGN_ADMIN_BGBackground color of the
{{ Admin }}element. -
GBT_CAR_SIGN_ADMIN_FG='red'Foreground color of the
{{ Admin }}element. -
GBT_CAR_SIGN_ADMIN_FMFormatting of the
{{ Admin }}element. -
GBT_CAR_SIGN_ADMIN_TEXT='#'Text content of the
{{ Admin }}element. -
GBT_CAR_SIGN_USER_BGBackground color of the
{{ User }}element. -
GBT_CAR_SIGN_USER_FG='light_green'Foreground color of the
{{ User }}element. -
GBT_CAR_SIGN_USER_FMFormatting of the
{{ User }}element. -
GBT_CAR_SIGN_USER_TEXT='$'Text content of the
{{ User }}element. The user name. -
GBT_CAR_SIGN_DISPLAY='1'Whether to display this car if it's in the list of cars (
GBT_CARS). -
GBT_CAR_SIGN_WRAP='0'Whether to wrap the prompt line in front of this car.
-
GBT_CAR_SIGN_SEP_TEXTText content of the separator for this car.
-
GBT_CAR_SIGN_SEP_BGBackground color of the separator for this car.
-
GBT_CAR_SIGN_SEP_FGForeground color of the separator for this car.
-
GBT_CAR_SIGN_SEP_FMFormatting of the separator for this car.
Car that visualizes return code of every command. By default, this car is displayed only when the return code is non-zero. If you want to display it even if the return code is zero, set the following variable:
export GBT_CAR_STATUS_DISPLAY='1'Variables used by the car:
-
GBT_CAR_STATUS_BGBackground color of the car. It's either
GBT_CAR_STATUS_OK_BGif the last command returned0return code otherwise theGBT_CAR_STATUS_ERROR_BGis used. -
GBT_CAR_STATUS_FG='default'Foreground color of the car. It's either
GBT_CAR_STATUS_OK_FGif the last command returned0return code otherwise theGBT_CAR_STATUS_ERROR_FGis used. -
GBT_CAR_STATUS_FM='none'Formatting of the car. It's either
GBT_CAR_STATUS_OK_FMif the last command returned0return code otherwise theGBT_CAR_STATUS_ERROR_FMis used. -
GBT_CAR_STATUS_FORMAT=' {{ Symbol }} 'Format of the car. This can be changed to contain also the value of the return code:
export GBT_CAR_STATUS_FORMAT=' {{ Symbol }} {{ Code }} '
or the signal name of the return code:
export GBT_CAR_STATUS_FORMAT=' {{ Symbol }} {{ Signal }} '
If you want to display the Status train even if there is no error, you have to use the
{{ Details }}element to prevent the{{ Code }}and/or{{ Signal }}from being displayed:export GBT_CAR_STATUS_DISPLAY=1 export GBT_CAR_STATUS_FORMAT=' {{ Symbol }}{{ Details }} '
Then you can modify the format of the
{{ Details }}element like this for when there is an error:export GBT_CAR_STATUS_DETAILS_FORMAT=' {{ Code }} {{ Signal }}'
-
GBT_CAR_STATUS_SYMBOL_BGBackground color of the
{{ Symbol }}element. -
GBT_CAR_STATUS_SYMBOL_FGForeground color of the
{{ Symbol }}element. -
GBT_CAR_STATUS_SYMBOL_FM='bold'Formatting of the
{{ Symbol }}element. -
GBT_CAR_STATUS_SYMBOL_FORMATFormat of the
{{ Symbol }}element. The format is either{{ Error }}if the last command returned non zero return code otherwise{{ User }}is used. -
GBT_CAR_STATUS_SIGNAL_BGBackground color of the
{{ Signal }}element. -
GBT_CAR_STATUS_SIGNAL_FGForeground color of the
{{ Signal }}element. -
GBT_CAR_STATUS_SIGNAL_FMFormatting color of the
{{ Signal }}element. -
GBT_CAR_STATUS_SIGNAL_TEXTText of the
{{ Signal }}element. -
GBT_CAR_STATUS_CODE_BG='red'Background color of the
{{ Code }}element. -
GBT_CAR_STATUS_CODE_FG='light_gray'Foreground color of the
{{ Code }}element. -
GBT_CAR_STATUS_CODE_FM='none'Formatting of the
{{ Code }}element. -
GBT_CAR_STATUS_CODE_TEXTText content of the
{{ Code }}element. The return code. -
GBT_CAR_STATUS_ERROR_BG='red'Background color of the
{{ Error }}element. -
GBT_CAR_STATUS_ERROR_FG='light_gray'Foreground color of the
{{ Error }}element. -
GBT_CAR_STATUS_ERROR_FM='none'Formatting of the
{{ Error }}element. -
GBT_CAR_STATUS_ERROR_TEXT='✘'Text content of the
{{ Error }}element. -
GBT_CAR_STATUS_OK_BG='green'Background color of the
{{ Ok }}element. -
GBT_CAR_STATUS_OK_FG='light_gray'Foreground color of the
{{ Ok }}element. -
GBT_CAR_STATUS_OK_FM='none'Formatting of the
{{ Ok }}element. -
GBT_CAR_STATUS_OK_TEXT='✔'Text content of the
{{ Ok }}element. -
GBT_CAR_STATUS_DISPLAYWhether to display this car if it's in the list of cars (
GBT_CARS). -
GBT_CAR_STATUS_WRAP='0'Whether to wrap the prompt line in front of this car.
-
GBT_CAR_STATUS_SEP_TEXTText content of the separator for this car.
-
GBT_CAR_STATUS_SEP_BGBackground color of the separator for this car.
-
GBT_CAR_STATUS_SEP_FGForeground color of the separator for this car.
-
GBT_CAR_STATUS_SEP_FMFormatting of the separator for this car.
Car that displays current date and time.
-
GBT_CAR_TIME_BG='light_blue'Background color of the car.
-
GBT_CAR_TIME_FG='light_gray'Foreground color of the car.
-
GBT_CAR_TIME_FM='none'Formatting of the car.
-
GBT_CAR_TIME_FORMAT=' {{ DateTime }} 'Format of the car.
-
GBT_CAR_TIME_DATETIME_BGBackground color of the
{{ DateTime }}element. -
GBT_CAR_TIME_DATETIME_FGForeground color of the
{{ DateTime }}element. -
GBT_CAR_TIME_DATETIME_FMFormatting of the
{{ DateTime }}element. -
GBT_CAR_TIME_DATETIME_FORMAT='{{ Date }} {{ Time }}'Format of the
{{ DateTime }}element. -
GBT_CAR_TIME_DATE_BGBackground color of the
{{ Date }}element. -
GBT_CAR_TIME_DATE_FGForeground color of the
{{ Date }}element. -
GBT_CAR_TIME_DATE_FMFormatting of the
{{ Date }}element. -
GBT_CAR_TIME_DATE_FORMAT='Mon 02 Jan'Format of the
{{ Date }}element. The format is using placeholders as described in thetime.Format()Go function. For exampleJanuaryis a placeholder for current full month name andPMis a placeholderAMif the current time is before noon orPMif the current time is after noon. So in order to display date in the format ofYYYY-MM-DD, the value of this variable should be2006-01-02. -
GBT_CAR_TIME_TIME_BGBackground color of the
{{ Host }}element. -
GBT_CAR_TIME_TIME_FG='light_yellow'Foreground color of the
{{ Host }}element. -
GBT_CAR_TIME_TIME_FMFormatting of the
{{ Host }}element. -
GBT_CAR_TIME_TIME_FORMAT='15:04:05'Text content of the
{{ Host }}element. The format principles are the same like in the case of theGBT_CAR_TIME_DATE_FORMATvariable above. So in order to display time in the 12h format, the value of this variable should be03:04:05 PM. -
GBT_CAR_TIME_DISPLAY='1'Whether to display this car if it's in the list of cars (
GBT_CARS). -
GBT_CAR_TIME_WRAP='0'Whether to wrap the prompt line in front of this car.
-
GBT_CAR_TIME_SEP_TEXTText content of the separator for this car.
-
GBT_CAR_TIME_SEP_BGBackground color of the separator for this car.
-
GBT_CAR_TIME_SEP_FGForeground color of the separator for this car.
-
GBT_CAR_TIME_SEP_FMFormatting of the separator for this car.
Benchmark of GBT can be done by faking the output of GBT by a testing script which executes as minimum of commands as possible. For simplicity, the test will produce output of the Git car only and will be done from within a directory with a Git repository.
The testing script is using exactly the same commands like GBT to determine the
Git branch, whether the Git repository contains any change and whether it's
ahead/behind of the remote branch. The script has the following content and is
stored in /tmp/test.sh:
BRANCH="$(git symbolic-ref HEAD)"
[ -z "$(git status --porcelain)" ] && DIRTY_ICON='%{\e[38;5;2m%}✔' || DIRTY_ICON='%{\e[38;5;1m%}✘'
[[ "$(git rev-list --count HEAD..@{upstream})" == '0' ]] && AHEAD_ICON='' || AHEAD_ICON=' ⬆'
[[ "$(git rev-list --count @{upstream}..HEAD)" == '0' ]] && BEHIND_ICON='' || BEHIND_ICON=' ⬇'
echo -en "%{\e[0m%}%{\e[48;5;7m%}%{\e[38;5;0m%} %{\e[48;5;7m%}%{\e[38;5;0m%}%{\e[48;5;7m%}%{\e[38;5;0m%} %{\e[48;5;7m%}%{\e[38;5;0m%}${BRANCH##*/}%{\e[48;5;7m%}%{\e[38;5;0m%} %{\e[48;5;7m%}%{\e[38;5;0m%}%{\e[48;5;7m%}$DIRTY_ICON%{\e[48;5;7m%}%{\e[38;5;0m%}%{\e[48;5;7m%}%{\e[38;5;0m%}%{\e[48;5;7m%}%{\e[38;5;0m%}$AHEAD_ICON%{\e[48;5;7m%}%{\e[38;5;0m%}%{\e[48;5;7m%}%{\e[38;5;0m%}$BEHIND_ICON%{\e[48;5;7m%}%{\e[38;5;0m%} %{\e[0m%}"The testing script produces the same output like GBT when run by Bash or ZSH:
bash /tmp/test.sh > /tmp/a
zsh /tmp/test.sh > /tmp/b
GBT_SHELL='zsh' GBT_CARS='Git' gbt > /tmp/c
diff /tmp/{a,b}
diff /tmp/{b,c}We will use ZSH to run 10 measurements of 100 executions of the testing script by Bash and ZSH as well as of GBT itself.
# Execution of the testing script by Bash
for N in $(seq 10); do time (for M in $(seq 100); do bash /tmp/test.sh 1>/dev/null 2>&1; done;) done 2>&1 | sed 's/.* //'
0.95s user 1.05s system 102% cpu 1.944 total
0.94s user 1.06s system 102% cpu 1.944 total
0.93s user 1.05s system 102% cpu 1.930 total
0.91s user 1.10s system 102% cpu 1.954 total
0.92s user 1.07s system 102% cpu 1.933 total
0.97s user 1.03s system 102% cpu 1.943 total
0.92s user 1.07s system 102% cpu 1.931 total
0.92s user 1.08s system 102% cpu 1.949 total
0.89s user 1.11s system 102% cpu 1.938 total
0.93s user 1.07s system 102% cpu 1.944 total
# Execution of the testing script by ZSH
for N in $(seq 10); do time (for M in $(seq 100); do zsh /tmp/test.sh 1>/dev/null 2>&1; done;) done 2>&1 | sed 's/.* //'
0.89s user 1.08s system 103% cpu 1.909 total
0.82s user 1.15s system 103% cpu 1.906 total
0.82s user 1.15s system 103% cpu 1.903 total
0.84s user 1.13s system 103% cpu 1.907 total
0.88s user 1.10s system 103% cpu 1.915 total
0.88s user 1.09s system 103% cpu 1.907 total
0.84s user 1.14s system 103% cpu 1.919 total
0.85s user 1.11s system 103% cpu 1.901 total
0.89s user 1.08s system 103% cpu 1.914 total
0.96s user 1.01s system 103% cpu 1.908 total
# Execution of GBT
for N in $(seq 10); do time (for M in $(seq 100); do GBT_SHELL='zsh' GBT_CARS='Git' gbt 1>/dev/null 2>&1; done;) done 2>&1 | sed 's/.* //'
1.03s user 1.19s system 115% cpu 1.922 total
0.98s user 1.18s system 115% cpu 1.874 total
1.06s user 1.11s system 115% cpu 1.880 total
1.02s user 1.14s system 115% cpu 1.867 total
1.04s user 1.17s system 115% cpu 1.918 total
1.05s user 1.10s system 115% cpu 1.853 total
1.07s user 1.11s system 115% cpu 1.895 total
1.01s user 1.18s system 115% cpu 1.903 total
1.08s user 1.03s system 115% cpu 1.825 total
1.05s user 1.09s system 115% cpu 1.844 totalFrom the above is visible that GBT performs faster than Bash and ZSH even if the testing script was as simple as possible. You can also notice that GBT was using more CPU than Bash or ZSH. That's probably because of the built-in concurrency support in Go.
In order to enjoy GBT prompt via SSH but also in Docker, Kubectl, Vagrant, MySQL or in Screen without the need to install GBT everywhere, you can use GBTS (GBT written in Shell). GBTS is a set of scripts which get forwarded to applications and remote connections and then executed to generate the nice looking prompt.
You can start using it by doing the following:
export GBT__HOME='/usr/share/gbt'
source $GBT__HOME/sources/gbts/cmd/local.shThis will automatically create command line aliases for all enabled plugins (by
default docker, gssh, kubectl, mysql, screen, ssh, su, sudo and
vagrant). Then just SSH to some remote server or enter some Docker container
(even via kubectl) or Vagrant box and you should get GBT prompt there.
If you want to have some of the default aliase available only on the remote site, just un-alias them locally:
unalias sudo suYou can also forward your own aliases which will be then available on any remote
site. For example to have alias ll='ls -l' on any remote site, just create the
following alias and it will be automatically forwarded:
alias gbt___ll='ls -l'The idea behind prompt forwarding is coming from Vladimir Babichev (@mrdrup) who was using it for several years before GBT even existed. After seeing the potential of GBT, he sparked the implementation of prompt forwarding into GBT which later turned into GBTS.
Principle of GBTS is to pass the GBTS scripts to the application and then execute
them. This is done by concatting all the GBTS scripts into one file and encoding
it by Base64 algorithm. Such string, together with few more commands, is then
used as an argument of the application which makes it to store it on the remote
site in the /tmp/.gbt.<NUM> file. The same we create the /tmp/.gbt.<NUM>.bash
script which is then used as a replacement of the real shell on the remote site.
For SSH it would look like this:
ssh -t myserver "export GBT__CONF='$GBT__CONF' && echo '<BASE64_ENCODED_STRING>' | base64 -d > \$GBT__CONF && bash --rcfile \$GBT__CONF"In order to make all this invisible, we wrap that command into a function (e.g.
gbt_ssh) and assign it to an alias of the same name like the original
application (e.g. ssh):
alias ssh='gbt_ssh'The same or very similar principle applies to other supported commands like
docker, gssh (GCP
SSH), kubectl,
mysql, screen, su, sudo and vagrant.
GBTS has few settings which can be used to influence its behaviour. See the details here.
To make GBTS working correctly between Linux and MacOS and vice versa requires a
little bit of fiddling. The reason is that the basic command line tools like
date and base64 are very old on MacOS and mostly incompatible with the Linux
world. Some tools are even called differently (e.g. md5sum is called md5).
Therefore if you want to make the remote script verification working (make sure nobody changed the remote script while using it), the following variables must be set:
# Use 'md5' command instead of 'md5sum'
export GBT__SOURCE_MD5_LOCAL='md5'
# Cut the 4th field from the output of 'md5'
export GBT__SOURCE_MD5_CUT_LOCAL='4'If you don't want to use this feature, you can disable it in which case the above variables won't be required:
export GBT__SOURCE_SEC_DISABLE=1When using the ExecTime car, the following variable must be set:
# Don't use nanoseconds in the 'ExecTime' car
export GBT__SOURCE_DATE_ARG='+%s'For maximum compatibility with GBT, it's recommended to install GNU coreutils
(brew install coreutils) and instead of the variable above use these:
# Use 'gdate' instead of 'date'
export GBT__SOURCE_DATE='gdate'
# Use 'gdate' instead of 'date' (only if you run GBT on a Mac)
export GBT__SOURCE_BASE64_LOCAL='gbase64'
# Use 'gdate' instead of 'date' (only if you are connection to Mac via SSH)
export GBT__SOURCE_BASE64='gbase64'When connecting to MacOS from Linux using gbt_ssh and not using gbase64 on
MacOS, the following variable must be set on Linux to make the Base64 decoding
working on MacOS:
# Use 'base64 -D' to decode Base64 encoded text
export GBT__SOURCE_BASE64_DEC='-D'- Requires Bash v4.x to run.
- The color representation and support of unicode characters for MySQL is broken in MySQL 5.6 and above. But it works just fine in all versions of Percona and MariaDB.
- Plugins
suandsudoare not supported on MacOS.
Contribution to the following is more than welcome:
- Optimize generated escape sequence
- Don't decorate empty string
- Don't decorate child element with the same attributes used by the parent
- Implement templating language to allow more dynamic configuration
- Jinja2-like syntax
- Should be able to refer variables from the local car
GBT_CAR_GIT_BG="{% 'red' if Status == '{{ StatusDirty }}' else 'light_gray' %}"
- Should be able to refer ENV variables (e.g.
env('HOME')) - Could be able to refer variables from another car
- Advanced functionality via pipes (e.g.
<expr> | substr(1,3))
- Add support for GBT plugins
- Load plugins with
GBT_PLUGINS='mycar1:/path/to/mycar1.so;mycar2:/path/to/mycar2.so' - Load the plugin, read the
Carsymbol and assign the reference to themycar1in thecarsFactory
- Load plugins with
- Implement Vim statusline using GBT as the generator
- Implement Tmux statusline using GBT as the generator
- Add weather car
- Using Yahoo Weather API
- Needs to cache the results in a file and refresh only if its timestamp is older than certain time. Or perhaps store the last update in env var?
- Add more themes
Jiri Tyr
MIT

