scripts/colors/pacman.py
Anna Schumaker 8a73ed3a61 Create a deploypkg.zsh command
For installing a package created through makepkg onto a remote machine

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2021-11-30 13:58:24 -05:00

22 lines
547 B
Python

import termcolor
import re
import sys
pacman_colors = dict()
pacman_attrs = dict()
def add_color_attr(field, color, *attrs):
pacman_colors[field] = color
pacman_attrs[field] = attrs
add_color_attr("==>", "green", "bold")
add_color_attr("->", "blue", "bold")
for line in sys.stdin:
if "==>" in line or "->" in line:
for part in re.split(r'(\s+)', line):
color = pacman_colors.get(part, "white")
attrs = pacman_attrs.get(part, ["bold"])
termcolor.cprint(part, color, attrs=attrs, end="")