ocarina/src/plugins/cline/run.py

36 lines
688 B
Python

#! /usr/bin/python
# To change this template, choose Tools | Templates
# and open the template in the editor.
__author__="bjschuma"
__date__ ="$Dec 19, 2009 11:38:46 PM$"
from session import manager
from session import settings
#from bt.message import write
import history
# Check for valid input
def run(input):
prompt = settings["prompt"]
input = input[len(prompt):].strip()
if len(input) == 0:
return prompt
split = input.split(';')
for line in split:
cmd = line.strip().split(' ')
if len(cmd)>1:
manager.run(cmd[0],cmd[1:])
else:
manager.run(line)
history.insert(input)
# Account for the prompt changing when the manager runs
return settings["prompt"]