Created
May 30, 2010 03:55
-
-
Save mmisono/418765 to your computer and use it in GitHub Desktop.
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/python | |
import cmd | |
import os | |
class MyShell(cmd.Cmd): | |
def __init__(self): | |
cmd.Cmd.__init__(self) | |
self.prompt = Pwd() | |
def do_cd(self,arg): | |
if arg == '': | |
arg = os.path.expanduser('~') | |
os.chdir(arg) | |
def emptyline(self): | |
pass | |
class Pwd(): | |
def __repr__(self): | |
return os.getcwd() + "% " | |
if __name__ == '__main__': | |
MyShell().cmdloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment