Last active
August 29, 2015 13:56
-
-
Save mwaskom/9244597 to your computer and use it in GitHub Desktop.
BASH prompt with current directory and git repository branch/state in a different color for each terminal window.
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
#! /usr/bin/env python | |
"""Randomly colored, useful BASH prompt. | |
Put this on your PATH `chmod u+x` it, and add | |
export PS1=`randps1.py` | |
to your .bash_profile file. | |
""" | |
from random import choice | |
colors = choice([1, 2]), 31 + choice(range(9)) | |
print '\[\e[%d;%dm\]' % colors + '[\W]$(__git_ps1 "{%s}")\$\[\e[m\] ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment