Skip to content
Snippets Groups Projects
Commit dce219c8 authored by Tim Jaacks's avatar Tim Jaacks
Browse files

Print less important output in grey color

parent 5e36261d
No related branches found
No related tags found
1 merge request!189Multiple integration pipelines
#!/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"
...@@ -4,6 +4,7 @@ import logging ...@@ -4,6 +4,7 @@ import logging
import requests import requests
import sys import sys
import time import time
from colors import colors
from furl import furl from furl import furl
from git import Actor, GitCommandError from git import Actor, GitCommandError
from git.repo.base import Repo from git.repo.base import Repo
...@@ -185,7 +186,12 @@ def commit_and_push( ...@@ -185,7 +186,12 @@ def commit_and_push(
print("Pushed new commit:") print("Pushed new commit:")
print(project.web_url + "/-/commit/" + revision) print(project.web_url + "/-/commit/" + revision)
if not less_verbose: 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 return revision
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment