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:
hploetz 2006-11-19 12:18:01 +00:00
parent c21d63752f
commit a0d78cf3a6
1 changed files with 12 additions and 2 deletions

View File

@ -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)