Skip to content

Instantly share code, notes, and snippets.

@bebraw
Created January 10, 2010 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bebraw/273528 to your computer and use it in GitHub Desktop.
Save bebraw/273528 to your computer and use it in GitHub Desktop.
from file import PluginDirectory
from interpreter import Interpreter
from plugin_loader import PluginLoader
class Application:
def run(self):
plugin_loader = PluginLoader()
plugin_directory = PluginDirectory()
commands = plugin_loader.load(plugin_directory)
interpreter = Interpreter(commands)
try:
while True:
input = self.input()
result = interpreter.interpret(input)
if result is not None:
if isinstance(result, str):
lines = result.split('\n')
if len(lines) > 1:
for line in lines:
self.output(line)
else:
self.output(result)
else:
self.output(result)
except SystemExit:
pass
def input(self):
return raw_input('>>> ')
def output(self, result):
print result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment