Improved printBanner method
This commit is contained in:
parent
fbfd765510
commit
f6d2012fbb
@ -1,28 +1,45 @@
|
|||||||
|
void call(String stepName, String boxColor = 'green', String textColor = 'white', String styleName = 'default') {
|
||||||
|
Map colors = [
|
||||||
|
black: '\u001b[30m',
|
||||||
|
red: '\u001b[31m',
|
||||||
|
green: '\u001b[32m',
|
||||||
|
yellow: '\u001b[33m',
|
||||||
|
blue: '\u001b[34m',
|
||||||
|
magenta: '\u001b[35m',
|
||||||
|
cyan: '\u001b[36m',
|
||||||
|
white: '\u001b[40;37m',
|
||||||
|
reset: '\u001b[0m',
|
||||||
|
]
|
||||||
|
|
||||||
void call(String stepName) {
|
Map boxStyles = [
|
||||||
red = '\033[31m'
|
default: [
|
||||||
blue = '\033[34m'
|
tr: '╔',
|
||||||
normal = '\033[0m'
|
tl: '╗',
|
||||||
|
sd: '║',
|
||||||
|
vr: '═',
|
||||||
|
br: '╚',
|
||||||
|
bl: '╜'
|
||||||
|
],
|
||||||
|
plain: [
|
||||||
|
tr: '+',
|
||||||
|
tl: '+',
|
||||||
|
sd: '|',
|
||||||
|
vr: '-',
|
||||||
|
br: '+',
|
||||||
|
bl: '+'
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
stepBanner = "║ $blue$stepName$red ║"
|
Map style = boxStyles[styleName]
|
||||||
|
|
||||||
|
stepBanner = style['sd'] + " ${colors[textColor]}$stepName${colors['reset']}${colors[boxColor]} " + style['sd']
|
||||||
bannerWidth = stepName.length() + 6
|
bannerWidth = stepName.length() + 6
|
||||||
|
|
||||||
top = '╔' + ('═' * bannerWidth) + '╗'
|
top = style['tr'] + (style['vr'] * bannerWidth) + style['tl']
|
||||||
bottom = '╚' + ('═' * bannerWidth) + '╝'
|
bottom = style['br'] + (style['vr'] * bannerWidth) + style['bl']
|
||||||
ansiColor('xterm') {
|
ansiColor('css') {
|
||||||
echo "$red$top\n$stepBanner\n$bottom$normal"
|
echo "${colors[boxColor]}$top\n$stepBanner\n$bottom${colors['reset']}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// fg_black = '\x1b[30m'
|
|
||||||
// fg_red = "\x1b[31m"
|
|
||||||
// fg_green = "\x1b[32m"
|
|
||||||
// fg_yellow = "\x1b[33m"
|
|
||||||
// fg_blue = "\x1b[34m"
|
|
||||||
// fg_magenta = "\x1b[35m"
|
|
||||||
// fg_cyan = "\x1b[36m"
|
|
||||||
// fg_white = "\x1b[37m"
|
|
||||||
// fg_default = "\x1b39m"
|
|
||||||
// fg_reset = "\x1b[0m"
|
|
||||||
|
|
||||||
// ═ ║ ╒ ╓ ╔ ╕ ╖ ╗ ╘ ╙ ╚ ╛ ╜ ╝ ╞ ╟ ╠ ╡ ╢ ╣ ╤ ╥ ╦ ╧ ╨ ╩ ╪ ╫ ╬
|
// ═ ║ ╒ ╓ ╔ ╕ ╖ ╗ ╘ ╙ ╚ ╛ ╜ ╝ ╞ ╟ ╠ ╡ ╢ ╣ ╤ ╥ ╦ ╧ ╨ ╩ ╪ ╫ ╬
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user