Skip to content

Commit

Permalink
Fixed another issue with piping output
Browse files Browse the repository at this point in the history
  • Loading branch information
Nepochal committed Nov 9, 2016
1 parent cf71092 commit 1cdc99b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion wallabag/wallabag_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import json
import os
from sys import exit
import sys
from bs4 import BeautifulSoup
import api
import conf
Expand All @@ -27,11 +28,13 @@ def show(entry_id, colors=True, raw=False, html=False):
exit(-1)

title = entr.title

try:
delimiter = "".ljust(os.get_terminal_size().columns, '=')
# piped output to file or other process
except OSError:
delimiter = "\n"

article = entr.content
if not html:
article = html2text(article, colors)
Expand Down Expand Up @@ -96,7 +99,12 @@ def html2text(html, colors=True):


def __format_text(text):
maxcol = os.get_terminal_size().columns
try:
maxcol = os.get_terminal_size().columns
# piped output to file or other process
except OSError:
maxcol = sys.maxsize

ret = ""

for line in text.splitlines():
Expand Down

0 comments on commit 1cdc99b

Please sign in to comment.