Created
November 22, 2013 16:45
-
-
Save da-ar/7603015 to your computer and use it in GitHub Desktop.
Bash style user prompt
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
import readline, glob, os | |
class ControllerDeploy: | |
def __init__(self): | |
print "Starting Deploy Script" | |
readline.set_completer_delims(" \n\t;") | |
readline.set_completer(complete) | |
readline.parse_and_bind("tab: complete") | |
while 1: | |
a = raw_input("> ") | |
print "You entered", a | |
def complete(val, state): | |
if(val[0] == "~"): | |
val = os.path.expanduser(val) | |
return (glob.glob(val+'*')+[None])[state] | |
if __name__ == "__main__": | |
main = ControllerDeploy() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment