Categorygithub.com/AstromechZA/prompt
modulepackage
0.0.0-20240419114633-64c37fab137d
Repository: https://github.com/astromechza/prompt.git
Documentation: pkg.go.dev

# README

prompt

My personal opinionated Bash prompt.

Features:

  • Shows exit code of previous command if it failed
  • Shows execution time of the previous command
  • Shows Git branch and status of working tree
  • Shows active Python virtualenv name if there is one
  • Adds a coloured, trailing '%' to the previous output if it didn't add a newline

example animation

How to install

You'll need a Go development environment for now, I have no plans to release prebuilt binaries at this time.

$ go get github.com/AstromechZA/prompt
$ cp $GOPATH/bin/prompt /usr/local/bin/prompt  # Rename it or put it somewhere else if you need to

And then in your Bash rc/profiles files:

source <(/usr/local/bin/prompt setup)

# Functions

After subcommand that runs after each command.
Before executes before each command to store the state.
FixCursor adds a newline if the cursor position is not at the start of line.
PutState writes the state object under the given uid.
StatePath returns the prompt state file for the given uid.
TryPopState attempts to retrieve the state object for the given uid.

# Structs

BeforeState object to store on disk.