ocarina/src/core/cli.py

38 lines
750 B
Python

#! /usr/bin/python
# To change this template, choose Tools | Templates
# and open the template in the editor.
__author__="bjschuma"
__date__ ="$Mar 13, 2010 9:08:56 PM$"
import ocarina
from ct.path import *
from ct.call import *
import readline
global history
history = join(ocarina.vars["$ocarina"],"history")
def loop():
while True:
try:
state = ocarina.vars["$writeenable"]
ocarina.vars["$writeenable"] = True
exec raw_input(ocarina.vars["$prompt"] + " ")
ocarina.vars["$writeenable"] = state
global history
readline.write_history_file(history)
# Catch this so that we can use ctrl-d to exit
except EOFError:
print ""
exit()
except Exception,e:
print e
#ocarina.events.invite("ocarina-start",loop)