dotfiles/welcome/main.py

36 lines
808 B
Python
Raw Normal View History

2018-12-02 15:19:28 +00:00
#!/usr/bin/env python
2018-08-08 20:08:05 +00:00
import re
2018-08-08 08:35:35 +00:00
2018-08-09 10:35:09 +00:00
from colors import Style, COLORS
from system_info import get_system_info
2018-08-08 08:35:35 +00:00
2018-08-08 18:16:26 +00:00
print("")
2018-08-08 08:35:35 +00:00
logo_lines, info_lines = get_system_info()
2018-08-08 18:16:26 +00:00
logo_line_widths = [len(re.sub(r"{\d}", "", line)) for line in logo_lines]
2018-08-08 08:35:35 +00:00
logo_width = max(logo_line_widths)
for line_index in range(0, max(len(logo_lines), len(info_lines))):
2018-08-08 18:16:26 +00:00
line = ""
logo_line_width = 0
2018-08-08 08:35:35 +00:00
2018-08-08 18:16:26 +00:00
if line_index < len(logo_lines):
logo_line = logo_lines[line_index]
logo_line_width = logo_line_widths[line_index]
2018-08-08 08:35:35 +00:00
2018-08-08 18:16:26 +00:00
line += Style.BRIGHT
line += logo_line.format(*COLORS)
line += Style.RESET_ALL
2018-08-08 08:35:35 +00:00
2018-08-08 18:16:26 +00:00
line += " " * (logo_width - logo_line_width + 3)
2018-08-08 08:35:35 +00:00
2018-08-08 18:16:26 +00:00
if line_index < len(info_lines):
info_line = info_lines[line_index]
line += info_line
2018-08-08 08:35:35 +00:00
2018-08-08 18:16:26 +00:00
print(line)
2018-08-08 08:35:35 +00:00
2018-08-08 18:16:26 +00:00
print("")