RobertKozak/fluent-git

fluent-git

This is a custom prompt for zsh and bash

This prompt can display, on a line, one or more of the following:

  • Time taken to execute command (if takes longer than 30 secs)
  • error code
  • hostname
  • username
  • local git status
  • remote git status
  • kubernetes cluster and namespace
  • path
  • ssh client connection

BASH

copy prompt.sh to $HOME and add to the end of .bashrc

ZSH

add fluent-git.theme to $ZSH/themes

cp fluent-git.theme $ZSH/themes

Example Screenshots

Example of the new prompt displaying execution time for last command

Prompt with timer

Example of the new prompt displaying error code

Example with error

Adding fluent-git prompt to remote machines (bash)

if you want this prompt to be available on machines you ssh into you will need to copy the prompt.sh and .bashrc-ssh file to the server.

  1. create alias in .bash_aliases
# when using -P arg: copy .bashrc-ssh file and do ssh else just do ssh
__ssh(){
   [[ $@ == *'-P'* ]] && echo "Copying bash profile for Fluent-git Prompt" && scp -q -o LogLevel=QUIET $HOME/.bashrc-ssh $1:/home/$USER/.bashrc
  
   /usr/bin/ssh $@
}

alias ssh="__ssh"
  1. copy .bashrc-ssh to $HOME
  1. Restart shell or source .bash_aliases
source $HOME./bash_aliases

once those steps are done next time you ssh with -P arg it will copy over the .bashrc-ssh file to the remote server as your new .bashrc which contains the new prompt

example: