You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
888 B

#!/usr/bin/env python2
# -*- coding:utf-8 -*-
import argparse
import collections
from papers import configs
from papers import commands
cmds = collections.OrderedDict([
('init', commands.init_cmd),
('add', commands.add_cmd),
('add_library', commands.add_library_cmd),
('import', commands.import_cmd),
('list', commands.list_cmd),
('edit', commands.edit_cmd),
('open', commands.open_cmd),
('websearch', commands.websearch_cmd)
])
config = configs.read_config()
parser = argparse.ArgumentParser(description="research papers repository")
subparsers = parser.add_subparsers(title="valid commands", dest="command")
for cmd_mod in cmds.values():
subparser = cmd_mod.parser(subparsers, config)
args = parser.parse_args()
args.config = config
cmd = args.command
del args.command
cmds[cmd].command(**vars(args))