Browse Source

added license info to boxprint

output-tor-startup
Kevin Froman 2 years ago
parent
commit
dee531fd51
  1. 12
      src/utils/boxprint.py

12
src/utils/boxprint.py

@ -1,8 +1,16 @@
def bordered(text):
"""Add box around string.
taken from https://stackoverflow.com/a/20757491 under https://creativecommons.org/licenses/by-sa/4.0/
https://stackoverflow.com/users/816449/bunyk
"""
def bordered(text: str) -> str:
"""Add border to string."""
lines = text.splitlines()
width = max(len(s) for s in lines)
res = ['' + '' * width + '']
for s in lines:
res.append('' + (s + ' ' * width)[:width] + '')
res.append('' + '' * width + '')
return '\n'.join(res)
return '\n'.join(res)

Loading…
Cancel
Save