Update of /cvsroot/cvsshell/cvsshell/src
In directory sc8-pr-cvs1:/tmp/cvs-serv13267/src
Modified Files:
basic_cmds.py
Log Message:
added expansion of '~' and support for '-' to the cd command
Index: basic_cmds.py
===================================================================
RCS file: /cvsroot/cvsshell/cvsshell/src/basic_cmds.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** basic_cmds.py 15 Apr 2003 13:40:09 -0000 1.25
--- basic_cmds.py 19 Apr 2003 18:07:12 -0000 1.26
***************
*** 80,94 ****
return app.BREAK_REPL
!
def changeDir(app, name, opts):
"Change the current working directory."
if len(opts) == 0:
opts = app.HOME
else:
! os.path.expanduser(opts)
try:
app.cd(opts)
except OSError, msg:
app.printErr(msg)
if app.cvsRootAutoUpdate:
root = app.readCvsRootFromFile()
--- 80,107 ----
return app.BREAK_REPL
! _oldDir = None
def changeDir(app, name, opts):
"Change the current working directory."
+ global _oldDir
+ try:
+ cur = os.getcwd()
+ except OSError, msg:
+ app.printErr(msg)
+ cur = None
if len(opts) == 0:
opts = app.HOME
+ elif opts == '-':
+ if _oldDir is not None:
+ opts = _oldDir
+ else:
+ return
else:
! opts = os.path.expanduser(opts)
try:
app.cd(opts)
except OSError, msg:
app.printErr(msg)
+ return
+ _oldDir = cur
if app.cvsRootAutoUpdate:
root = app.readCvsRootFromFile()
|