Created
February 22, 2021 14:56
-
-
Save CodyKochmann/5d780705794b06d418b9f47f945d5e4f to your computer and use it in GitHub Desktop.
bash prompt for ish
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function assert-exists(){ | |
# non-zero exit if args dont exist | |
ls "$@" 2>/dev/null >/dev/null | |
} | |
function branch-prompt(){ | |
assert-exists .git && git status | awk '/On branch/ {print "("$3")"}' | |
} | |
export PS1="\D{%y-%m-%dT%H:%m:%S} \H \`pwd\`\`branch-prompt\` -- " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment