mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Use platform dependant line separator for calibredb list
This commit is contained in:
parent
a41fcfd3db
commit
d3eb47e86f
@ -13,7 +13,7 @@ from calibre import prints
|
|||||||
from calibre.db.cli.utils import str_width
|
from calibre.db.cli.utils import str_width
|
||||||
from calibre.ebooks.metadata import authors_to_string
|
from calibre.ebooks.metadata import authors_to_string
|
||||||
from calibre.utils.date import isoformat
|
from calibre.utils.date import isoformat
|
||||||
from polyglot.builtins import iteritems, unicode_type, map
|
from polyglot.builtins import as_bytes, iteritems, map, unicode_type
|
||||||
|
|
||||||
readonly = True
|
readonly = True
|
||||||
version = 0 # change this if you change signature of implementation()
|
version = 0 # change this if you change signature of implementation()
|
||||||
@ -204,6 +204,7 @@ def do_list(
|
|||||||
with ColoredStream(sys.stdout, fg='green'):
|
with ColoredStream(sys.stdout, fg='green'):
|
||||||
prints(''.join(titles))
|
prints(''.join(titles))
|
||||||
stdout = getattr(sys.stdout, 'buffer', sys.stdout)
|
stdout = getattr(sys.stdout, 'buffer', sys.stdout)
|
||||||
|
linesep = as_bytes(os.linesep)
|
||||||
|
|
||||||
wrappers = [TextWrapper(x - 1).wrap if x > 1 else lambda y: y for x in widths]
|
wrappers = [TextWrapper(x - 1).wrap if x > 1 else lambda y: y for x in widths]
|
||||||
|
|
||||||
@ -219,7 +220,7 @@ def do_list(
|
|||||||
if i < len(text) - 1:
|
if i < len(text) - 1:
|
||||||
filler = ('%*s' % (widths[i] - str_width(ft) - 1, ''))
|
filler = ('%*s' % (widths[i] - str_width(ft) - 1, ''))
|
||||||
stdout.write((filler + separator).encode('utf-8'))
|
stdout.write((filler + separator).encode('utf-8'))
|
||||||
stdout.write(b'\n')
|
stdout.write(linesep)
|
||||||
|
|
||||||
|
|
||||||
def option_parser(get_parser, args):
|
def option_parser(get_parser, args):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user