/shelby

The Prompt with Wings🦋

Primary LanguageGoGNU General Public License v3.0GPL-3.0

Build Status Go Report Card

Shelby is a fast ⚡️ ,lightweight ☁️ ,minimal✨, shell prompt written in Pure Go.


Installation

Follow the steps below, and Post Installation Instructions

  • Run
$ sh -c "$(curl -sL https://git.io/ishelby)"	

OR For MacOS Users, install via Homebrew

brew install athul/tap/shelby

OR

  • Download the binary from the WorkFlow Artifacts(Only for Linux)
  • You might wanto to make the binary executable, run chmod +x <binary_name>
  • Move the Binary to /usr/local/bin/

Build From Source

  • Clone the Repo
  • Run go get -v
  • Run go build
  • Move the Binary to ~/.local/bin/shelby

Post Installation Instructions

You must have to add the below code to either the Bashrc or Zshrc file inorder to Shelby to fully work.

The following usage examples are just one example of how Shelby can be configured. The examples below will result in a setup similar to the one shown in the demo above: the prompt symbol () changes to red if the previous command exited with an error.

Bash

Add this to your .bashrc file:

prompt_shelby_load() {
if [ $? != 0 ]; then
    local prompt_symbol="\[\e[0;91m\]❯\[\e[0m\]"
  else
    local prompt_symbol="\[\e[0;92m\]❯\[\e[0m\]"
  fi

  PS1="$(~/.local/bin/shelby)\n${prompt_symbol} " 
}
PROMPT_COMMAND=prompt_shelby_load

Zsh

Add this to your .zshrc file:

autoload -Uz add-zsh-hook
prompt_shelby_cmd() { ~/.local/bin/shelby }
add-zsh-hook precmd prompt_shelby_cmd
prompt_symbol=''

PROMPT=$'%(?.%{\e[92m%}.%{\e[91m%})${prompt_symbol}%f'

Extra Bits

  • Displays the Current Git Branch
  • shows if any staged files are present
  • [+] shows if you've got Untracked Files
    • [2+] shows if you've got 2 untracked files
  • [!] shows if you've got Unstaged Files
    • [3!] shows if you've got 3 unstaged files
  • if your HEAD is ahead
  • if your HEAD is behind
  • if your HEAD is diverged
  • Dispalys any VirtualENVs you're working in
  • Displays Username and Hostname of the machine while in SSH
  • Small Size(~=2MB)

Inspired From

Code reused from ❤️

Support My work

Donations

Donation: UPI ID: athul8720@oksbi

Logo Made by Sreeram aka @fillerink

The Installation Script can be found at https://github.com/athul/autom