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 signal
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
import textwrap
|
||||||
from time import time
|
from time import time
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from shutil import which
|
from shutil import which, get_terminal_size
|
||||||
|
|
||||||
import data
|
import data
|
||||||
import config
|
import config
|
||||||
|
@ -78,6 +79,12 @@ def print_category_details(view_cat):
|
||||||
|
|
||||||
def print_thread_details(post_id) -> tuple:
|
def print_thread_details(post_id) -> tuple:
|
||||||
"""produces thread detail data, prints it to the console"""
|
"""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
|
# get post data
|
||||||
parent_id: str = ""
|
parent_id: str = ""
|
||||||
post_url: str = ""
|
post_url: str = ""
|
||||||
|
@ -116,8 +123,8 @@ def print_thread_details(post_id) -> tuple:
|
||||||
)
|
)
|
||||||
comment = line[6]
|
comment = line[6]
|
||||||
print(
|
print(
|
||||||
" {} {}: {}".format(
|
line_wrapper.fill(
|
||||||
comment_date, style_text(comment_author, "bold"), comment
|
"{} {}: {}".format(comment_date, comment_author, comment)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue