From a8e95017c71cc8007bef9dd7ddbe6728a5fd924d Mon Sep 17 00:00:00 2001 From: Patrick Totzke Date: Fri, 21 Mar 2014 14:14:18 +0000 Subject: properly interpret initial_command as cmdsequence This ensures the default initial command as given by the `initial_command` config option will be interpreted as command*line* as expected, and not as single command. As a result, one can now use e.g. initial_command = search A ; search B issue: #698 --- alot/init.py | 8 ++------ alot/ui.py | 8 ++++---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/alot/init.py b/alot/init.py index 5f8780ec..8c7a64ac 100755 --- a/alot/init.py +++ b/alot/init.py @@ -10,7 +10,6 @@ from alot.settings import settings from alot.settings.errors import ConfigError from alot.db.manager import DBManager from alot.ui import UI -import alot.commands as commands from alot.commands import * from alot.commands import CommandParseError @@ -174,17 +173,14 @@ def main(): query = ' '.join(args.subOptions.args) cmdstring = 'search %s %s' % (args.subOptions.as_argparse_opts(), query) - cmd = commands.commandfactory(cmdstring, 'global') elif args.subCommand == 'compose': cmdstring = 'compose %s' % args.subOptions.as_argparse_opts() if args.subOptions.rest is not None: cmdstring += ' ' + args.subOptions.rest - cmd = commands.commandfactory(cmdstring, 'global') else: - default_commandline = settings.get('initial_command') - cmd = commands.commandfactory(default_commandline, 'global') + cmdstring = settings.get('initial_command') except CommandParseError, e: sys.exit(e) # set up and start interface - UI(dbman, cmd) + UI(dbman, cmdstring) diff --git a/alot/ui.py b/alot/ui.py index cc578725..e9624e54 100644 --- a/alot/ui.py +++ b/alot/ui.py @@ -24,11 +24,11 @@ class UI(object): responsible for opening, closing and focussing buffers. """ - def __init__(self, dbman, initialcmd): + def __init__(self, dbman, initialcmdline): """ :param dbman: :class:`~alot.db.DBManager` - :param initialcmd: commandline applied after setting up interface - :type initialcmd: str + :param initialcmdline: commandline applied after setting up interface + :type initialcmdline: str :param colourmode: determines which theme to chose :type colourmode: int in [1,16,256] """ @@ -81,7 +81,7 @@ class UI(object): self.mainloop.screen.set_terminal_properties(colors=colourmode) logging.debug('fire first command') - self.apply_command(initialcmd) + self.apply_commandline(initialcmdline) # start urwids mainloop self.mainloop.run() -- cgit v1.2.3