def apply(self, ui): logging.info('open command shell') mode = ui.mode or 'global' cmpl = CommandLineCompleter(ui.dbman, mode, ui.current_buffer) cmdline = yield ui.prompt( '', text=self.startwith, completer=cmpl, history=ui.commandprompthistory, ) logging.debug('CMDLINE: %s' % cmdline) # interpret and apply commandline if cmdline: # save into prompt history ui.commandprompthistory.append(cmdline) ui.apply_commandline(cmdline)
def apply(self, ui): logging.info('open command shell') mode = ui.mode or 'global' cmpl = CommandLineCompleter(ui.dbman, mode, ui.current_buffer) cmdline = yield ui.prompt( '', text=self.startwith, completer=cmpl, history=ui.commandprompthistory, ) logging.debug('CMDLINE: %s' % cmdline) # interpret and apply commandline if cmdline: # save into prompt history ui.commandprompthistory.append(cmdline) try: cmd = commandfactory(cmdline, mode) ui.apply_command(cmd) except CommandParseError, e: ui.notify(e.message, priority='error')