Merge pull request 'Formatted replies to wrap and have a hanging indent' (#89) from wrap_replies into master

This commit is contained in:
cmccabe 2020-05-13 22:20:05 -04:00
commit 7640106fe9
1 changed files with 10 additions and 3 deletions

View File

@ -7,10 +7,11 @@ import getpass
import signal
import subprocess
import sys
import textwrap
from time import time
from urllib.parse import urlparse
from datetime import datetime
from shutil import which
from shutil import which, get_terminal_size
import data
import config
@ -78,6 +79,12 @@ def print_category_details(view_cat):
def print_thread_details(post_id) -> tuple:
"""produces thread detail data, prints it to the console"""
# set up line wrapping
columns, _ = get_terminal_size()
line_wrapper = textwrap.TextWrapper(
initial_indent=" " * 2, subsequent_indent=" " * 21, width=columns
)
# get post data
parent_id: str = ""
post_url: str = ""
@ -116,8 +123,8 @@ def print_thread_details(post_id) -> tuple:
)
comment = line[6]
print(
" {} {}: {}".format(
comment_date, style_text(comment_author, "bold"), comment
line_wrapper.fill(
"{} {}: {}".format(comment_date, comment_author, comment)
)
)
else: