Skip to content

Instantly share code, notes, and snippets.

@mmisono
Created May 30, 2010 03:55
Show Gist options
  • Save mmisono/418765 to your computer and use it in GitHub Desktop.
Save mmisono/418765 to your computer and use it in GitHub Desktop.
#!/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