# Assorted useful tidbits for subclasses
+ def _submit_command(self, command_message, ui_to_command_queue):
+ log = logging.getLogger('hooke')
+ log.debug('executing %s' % command_message)
+ ui_to_command_queue.put(command_message)
+
def _splash_text(self, extra_info, **kwargs):
return ("""
Hooke version %s
import readline # including readline makes cmd.Cmd.cmdloop() smarter
except ImportError, e:
import logging
- logging.warn('Could not import readline, bash-like line editing disabled.')
+ logging.warn('could not import readline, bash-like line editing disabled.')
import shlex
from ..command import CommandExit, Exit, Command, Argument, StoreValue
def __init__(self, *args, **kwargs):
super(DoCommand, self).__init__(*args, **kwargs)
self.parser = CommandLineParser(self.command, self.name_fn)
- self.log = logging.getLogger('hooke')
def __call__(self, args):
try:
self.cmd.stdout.write('Failure\n')
return
cm = CommandMessage(self.command.name, args)
- self.log.debug('executing %s' % cm)
- self.cmd.inqueue.put(cm)
+ self.cmd.ui._submit_command(cm, self.cmd.inqueue)
while True:
msg = self.cmd.outqueue.get()
if isinstance(msg, Exit):
if len(args[arg.name]) == 0:
args[arg.name] = arg.default
cm = CommandMessage(self.command.name, args)
- self.log.debug('executing %s' % cm)
- self.inqueue.put(cm)
+ self.gui._submit_command(cm, self.inqueue)
results = []
while True:
msg = self.outqueue.get()