Removes paging from list command.
This commit is contained in:
parent
f8e370f288
commit
099e764c04
@ -46,7 +46,7 @@ def colored(s, color=None, bold=False):
|
|||||||
color_code = COLORS[color]
|
color_code = COLORS[color]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
if bold:
|
if bold:
|
||||||
color_code = CODE
|
color_code = BOLD
|
||||||
else:
|
else:
|
||||||
color_code = ''
|
color_code = ''
|
||||||
if color_code != '':
|
if color_code != '':
|
||||||
@ -54,3 +54,7 @@ def colored(s, color=None, bold=False):
|
|||||||
else:
|
else:
|
||||||
end_code = ''
|
end_code = ''
|
||||||
return color_code + s + end_code
|
return color_code + s + end_code
|
||||||
|
|
||||||
|
|
||||||
|
def not_colored(s, **kwargs):
|
||||||
|
return s
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
import subprocess
|
|
||||||
import tempfile
|
|
||||||
|
|
||||||
from .. import pretty
|
from .. import pretty
|
||||||
from ..color import colored
|
|
||||||
from .. import repo
|
from .. import repo
|
||||||
|
|
||||||
|
|
||||||
@ -15,14 +11,10 @@ def command(config, ui):
|
|||||||
rp = repo.Repository.from_directory()
|
rp = repo.Repository.from_directory()
|
||||||
articles = []
|
articles = []
|
||||||
for n, p in enumerate(rp.all_papers()):
|
for n, p in enumerate(rp.all_papers()):
|
||||||
bibdesc = pretty.bib_oneliner(p.bibentry)
|
bibdesc = pretty.bib_oneliner(p.bibentry, color=ui.color)
|
||||||
articles.append((u'{num:d}: [{citekey}] {descr}'.format(
|
articles.append((u'{num:d}: [{citekey}] {descr}'.format(
|
||||||
num=int(n),
|
num=int(n),
|
||||||
citekey=colored(rp.citekeys[n], 'purple'),
|
citekey=ui.colored(rp.citekeys[n], 'purple'),
|
||||||
descr=bibdesc,
|
descr=bibdesc,
|
||||||
)).encode('utf-8'))
|
)).encode('utf-8'))
|
||||||
|
ui.print_('\n'.join(articles))
|
||||||
with tempfile.NamedTemporaryFile(suffix=".tmp", delete=True) as tmpf:
|
|
||||||
tmpf.write('\n'.join(articles))
|
|
||||||
tmpf.flush()
|
|
||||||
subprocess.call(['less', '-XRF', tmpf.name])
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# display formatting
|
# display formatting
|
||||||
|
|
||||||
from color import colored
|
from color import colored, not_colored
|
||||||
from pybtex.bibtex.utils import bibtex_purify
|
from pybtex.bibtex.utils import bibtex_purify
|
||||||
|
|
||||||
|
|
||||||
@ -26,7 +26,11 @@ def short_authors(bibentry):
|
|||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def bib_oneliner(bibentry):
|
def bib_oneliner(bibentry, color=True):
|
||||||
|
if color:
|
||||||
|
col_func = colored
|
||||||
|
else:
|
||||||
|
col_func = not_colored
|
||||||
authors = short_authors(bibentry)
|
authors = short_authors(bibentry)
|
||||||
title = bibtex_purify(bibentry.fields['title'])
|
title = bibtex_purify(bibentry.fields['title'])
|
||||||
year = bibtex_purify(bibentry.fields.get('year', ''))
|
year = bibtex_purify(bibentry.fields.get('year', ''))
|
||||||
@ -36,9 +40,9 @@ def bib_oneliner(bibentry):
|
|||||||
field = 'booktitle'
|
field = 'booktitle'
|
||||||
journal = bibtex_purify(bibentry.fields.get(field, ''))
|
journal = bibtex_purify(bibentry.fields.get(field, ''))
|
||||||
return u'{authors} \"{title}\" {journal} ({year})'.format(
|
return u'{authors} \"{title}\" {journal} ({year})'.format(
|
||||||
authors=colored(authors, 'cyan'),
|
authors=col_func(authors, 'cyan'),
|
||||||
title=title,
|
title=title,
|
||||||
journal=colored(journal, 'yellow'),
|
journal=col_func(journal, 'yellow'),
|
||||||
year=year,
|
year=year,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user