diff --git a/scripts/colors.py b/scripts/colors.py new file mode 100755 index 0000000000000000000000000000000000000000..f218ab01cb21b12a8c009910677ea9635abc328b --- /dev/null +++ b/scripts/colors.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +# Taken from here: https://stackoverflow.com/a/26445590/3018229 +class colors: + """Colors class: + Reset all colors with colors.reset + Two subclasses fg for foreground and bg for background. + Use as colors.subclass.colorname. + i.e. colors.fg.red or colors.bg.green + Also, the generic bold, disable, underline, reverse, strikethrough, + and invisible work with the main class + i.e. colors.bold + """ + + reset = "\033[0m" + bold = "\033[01m" + dim = "\033[02m" + underline = "\033[04m" + reverse = "\033[07m" + strikethrough = "\033[09m" + invisible = "\033[08m" + + class fg: + black = "\033[30m" + red = "\033[31m" + green = "\033[32m" + orange = "\033[33m" + blue = "\033[34m" + purple = "\033[35m" + cyan = "\033[36m" + lightgrey = "\033[37m" + darkgrey = "\033[90m" + lightred = "\033[91m" + lightgreen = "\033[92m" + yellow = "\033[93m" + lightblue = "\033[94m" + pink = "\033[95m" + lightcyan = "\033[96m" + + class bg: + black = "\033[40m" + red = "\033[41m" + green = "\033[42m" + orange = "\033[43m" + blue = "\033[44m" + purple = "\033[45m" + cyan = "\033[46m" + lightgrey = "\033[47m" diff --git a/scripts/common.py b/scripts/common.py index cd1b8b4b81467080618af6b33ef98a1808ae0a5b..e6e4f654d0d11afba851c5e972d66c7323a5d40c 100755 --- a/scripts/common.py +++ b/scripts/common.py @@ -4,6 +4,7 @@ import logging import requests import sys import time +from colors import colors from furl import furl from git import Actor, GitCommandError from git.repo.base import Repo @@ -185,7 +186,12 @@ def commit_and_push( print("Pushed new commit:") print(project.web_url + "/-/commit/" + revision) if not less_verbose: - print(repo.git.show("--summary", "--decorate") + "\n") + print( + colors.fg.lightgrey + + repo.git.show("--summary", "--decorate") + + colors.reset + + "\n" + ) return revision