mirror of https://github.com/zeldaret/oot.git
Colored Jenkins output
This commit is contained in:
parent
d4a87889ff
commit
3bf1e4afd9
|
@ -3,6 +3,10 @@ pipeline {
|
|||
label 'oot'
|
||||
}
|
||||
|
||||
options {
|
||||
ansiColor('xterm')
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Check formatting (full)') {
|
||||
when {
|
||||
|
|
|
@ -13,6 +13,7 @@ from dataclasses import dataclass
|
|||
import io
|
||||
import multiprocessing
|
||||
import multiprocessing.pool
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import shlex
|
||||
|
@ -36,9 +37,12 @@ import mapfile_parser.mapfile
|
|||
# Set on program start since we replace sys.stdout in worker processes
|
||||
stdout_isatty = sys.stdout.isatty()
|
||||
|
||||
# https://no-color.org/
|
||||
enable_colors = os.environ.get("NO_COLOR", "") == ""
|
||||
|
||||
|
||||
def output(message: str = "", color: Optional[str] = None, end: str = "\n"):
|
||||
if color and stdout_isatty:
|
||||
if color and enable_colors:
|
||||
print(f"{color}{message}{colorama.Fore.RESET}", end=end)
|
||||
else:
|
||||
print(message, end=end)
|
||||
|
|
Loading…
Reference in New Issue