summaryrefslogtreecommitdiff
path: root/alot/init.py
diff options
context:
space:
mode:
Diffstat (limited to 'alot/init.py')
-rwxr-xr-xalot/init.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/alot/init.py b/alot/init.py
index 5b479d35..0184a6aa 100755
--- a/alot/init.py
+++ b/alot/init.py
@@ -25,7 +25,9 @@ import settings
from account import AccountManager
from db import DBManager
from ui import UI
-from command import interpret_commandline
+import alot.commands as commands
+from commands import *
+from alot.commands import CommandParseError
def parse_args():
@@ -91,6 +93,7 @@ def main():
logging.basicConfig(level=numeric_loglevel, filename=logfilename)
logger = logging.getLogger()
+ #logger.debug(commands.COMMANDS)
#accountman
aman = AccountManager(settings.config)
@@ -98,13 +101,15 @@ def main():
dbman = DBManager(path=args.db_path, ro=args.read_only)
# get initial searchstring
- if args.command != '':
- cmd = interpret_commandline(args.command, 'global')
- if cmd is None:
- sys.exit('Invalid command: ' + args.command)
- else:
- default_commandline = settings.config.get('general', 'initial_command')
- cmd = interpret_commandline(default_commandline, 'global')
+ try:
+ if args.command != '':
+ cmd = commands.commandfactory(args.command, 'global')
+ else:
+ default_commandline = settings.config.get('general',
+ 'initial_command')
+ cmd = commands.commandfactory(default_commandline, 'global')
+ except CommandParseError, e:
+ sys.exit(e)
# set up and start interface
UI(dbman,