Skip to content

Commit

Permalink
Broarder text
Browse files Browse the repository at this point in the history
  • Loading branch information
maebert committed Sep 10, 2018
1 parent 618b9cc commit 1f0fcf4
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/shellcraft/_cli_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def _color_in(match):


def _format_str(s):
return re.sub(r'(([\$\*%`])[{};:.a-z0-9_\- ]+(\2))', _color_in, s)
return re.sub(r'(([\$\*%`])[{};:.a-z0-9_\- \n]+(\2))', _color_in, s)


def _unformat_str(s):
Expand Down Expand Up @@ -187,18 +187,15 @@ def echo(s, *vals, **kwargs):
result = ""
for line in s.splitlines():
if not line.startswith(">"):
for l in textwrap.wrap(line, width=min(60, term_width - 2)):
if l.startswith("`"):
result += "\n " + l + "\n"
else:
result += l + "\n"
for l in textwrap.wrap(line, width=min(80, term_width - 2)):
result += l + "\n"
result += "\n"
else:
# Format letter

line = line.replace("> > ", "\n")
line = line.replace("> ", "")
w = min(50, term_width - 12)
w = min(60, term_width - 12)
result += Color.paper(" ╭┄┬┄" + "┄" * w + "┄╮\n")
result += Color.paper(" ╰┄┤ " + " " * w + " ┊\n")
for paragraph in filter(bool, line.splitlines()):
Expand Down

0 comments on commit 1f0fcf4

Please sign in to comment.