forked from cmccabe/linkulator2
Formatted replies to wrap and have a hanging indent
This commit is contained in:
parent
ea9d833f6f
commit
b83d850a86
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue