pubs/papers/commands/add_library_cmd.py
Jonathan Grizou 31cf4de9d3 Change call for command from "cmds[cmd].command(**vars(args))" to "cmds[cmd].command(args)".
Applied  the corresponding changes to command files.
AMakes it possible to declare and use additional parser inside subparsers.
May be useful for tag command. Will be implemented in texnote plugin.
2013-07-03 23:01:47 +02:00

23 lines
558 B
Python

from .. import repo
from ..paper import Paper
from ..configs import config
def parser(subparsers):
parser = subparsers.add_parser('add_library',
help='add a set of papers to the repository')
parser.add_argument('bibfile', help='bibtex, bibtexml or bibyaml file')
return parser
def command(args):
"""
:param bibfile bibtex file (in .bib, .bibml or .yaml format.
"""
ui = args.ui
bibfile = args.bibfile
rp = repo.Repository(config())
for p in Paper.many_from_bib(bibfile):
rp.add_paper(p)