implement reading of ~/.basenamerc
git-svn-id: svn+ssh://localhost/home/henryk/svn/cyberflex-shell/trunk@129 f711b948-2313-0410-aaa9-d29f33439f0b
This commit is contained in:
parent
c21d63752f
commit
a0d78cf3a6
14
shell.py
14
shell.py
|
@ -74,20 +74,30 @@ class Shell:
|
|||
not (normally) return."""
|
||||
|
||||
line = ""
|
||||
lines = []
|
||||
try:
|
||||
fp = file(os.path.join(os.environ["HOME"], ".%src" % self.basename))
|
||||
lines = fp.readlines()
|
||||
fp.close()
|
||||
except IOError:
|
||||
pass
|
||||
|
||||
while True:
|
||||
try:
|
||||
for function in self.pre_hook:
|
||||
function()
|
||||
|
||||
line = raw_input("%s> " % self.prompt)
|
||||
if len(lines) > 0:
|
||||
line = lines.pop(0)
|
||||
else:
|
||||
line = raw_input("%s> " % self.prompt)
|
||||
|
||||
except EOFError:
|
||||
print ## line break (there probably was none after the prompt)
|
||||
break
|
||||
except KeyboardInterrupt:
|
||||
print ## only clear the current command
|
||||
continue
|
||||
continue
|
||||
|
||||
try:
|
||||
self.parse_and_execute(line)
|
||||
|
|
Loading…
Reference in New Issue