Use platform dependant line separator for calibredb list

This commit is contained in:
Kovid Goyal 2020-02-23 08:44:17 +05:30
parent a41fcfd3db
commit d3eb47e86f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -13,7 +13,7 @@ from calibre import prints
from calibre.db.cli.utils import str_width
from calibre.ebooks.metadata import authors_to_string
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
version = 0 # change this if you change signature of implementation()
@ -204,6 +204,7 @@ def do_list(
with ColoredStream(sys.stdout, fg='green'):
prints(''.join(titles))
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]
@ -219,7 +220,7 @@ def do_list(
if i < len(text) - 1:
filler = ('%*s' % (widths[i] - str_width(ft) - 1, ''))
stdout.write((filler + separator).encode('utf-8'))
stdout.write(b'\n')
stdout.write(linesep)
def option_parser(get_parser, args):