updated list cmd
This commit is contained in:
parent
353a282b42
commit
017a31460d
@ -1,8 +1,8 @@
|
||||
import init_cmd
|
||||
import add_cmd
|
||||
import list_cmd
|
||||
# import import_cmd
|
||||
# import export_cmd
|
||||
# import list_cmd
|
||||
# import edit_cmd
|
||||
# import remove_cmd
|
||||
# import open_cmd
|
||||
|
@ -59,7 +59,6 @@ def command(args):
|
||||
if bibdata is None:
|
||||
ui.error('invalid bibfile {}.'.format(bibfile))
|
||||
|
||||
print bibdata
|
||||
# citekey
|
||||
|
||||
citekey = args.citekey
|
||||
@ -74,7 +73,7 @@ def command(args):
|
||||
if tags is not None:
|
||||
p.tags = set(tags.split(','))
|
||||
|
||||
p = paper.Paper(citekey=citekey, bibdata=bibdata)
|
||||
p = paper.Paper(bibdata, citekey=citekey)
|
||||
|
||||
# document file
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
from .. import repo
|
||||
from . import helpers
|
||||
from .. import pretty
|
||||
from ..configs import config
|
||||
from ..uis import get_ui
|
||||
|
||||
@ -29,7 +29,7 @@ def command(args):
|
||||
filter_paper(p, args.query, case_sensitive=args.case_sensitive),
|
||||
enumerate(rp.all_papers()))
|
||||
ui.print_('\n'.join(
|
||||
helpers.paper_oneliner(p, n=n, citekey_only=args.citekeys)
|
||||
pretty.paper_oneliner(p, n=n, citekey_only=args.citekeys)
|
||||
for n, p in papers))
|
||||
|
||||
|
||||
|
@ -15,9 +15,9 @@ from .__init__ import __version__
|
||||
CORE_CMDS = collections.OrderedDict([
|
||||
('init', commands.init_cmd),
|
||||
('add', commands.add_cmd),
|
||||
('list', commands.list_cmd),
|
||||
# ('import', commands.import_cmd),
|
||||
# ('export', commands.export_cmd),
|
||||
# ('list', commands.list_cmd),
|
||||
# ('edit', commands.edit_cmd),
|
||||
# ('remove', commands.remove_cmd),
|
||||
# ('open', commands.open_cmd),
|
||||
|
@ -50,3 +50,16 @@ def bib_desc(bib_data):
|
||||
s += '\n'
|
||||
s += '\n'.join('{}: {}'.format(k, v) for k, v in article.fields.items())
|
||||
return s
|
||||
|
||||
|
||||
def paper_oneliner(p, n = 0, citekey_only = False):
|
||||
if citekey_only:
|
||||
return p.citekey
|
||||
else:
|
||||
bibdesc = bib_oneliner(p.bibentry)
|
||||
return (u'[{citekey}] {descr} {tags}'.format(
|
||||
citekey=color.dye(p.citekey, color.purple),
|
||||
descr=bibdesc,
|
||||
tags=color.dye(' '.join(p.tags),
|
||||
color.purple, bold=True),
|
||||
)).encode('utf-8')
|
Loading…
x
Reference in New Issue
Block a user