Further refinements

This commit is contained in:
Jim Nicholson 2024-02-13 02:47:04 -08:00
parent f6d2012fbb
commit ddc5b9a6d0
2 changed files with 14 additions and 3 deletions

View File

@ -12,7 +12,7 @@ void call(Map config = [:], Closure body = { }) {
] ]
Map runConfig = defaults + config Map runConfig = defaults + config
stage(runConfig.stepName) { stage(runConfig.stepName) {
printBanner(runConfig.stepName) printBanner(runConfig.stepName, [ boxStyle : 'plain' ])
if (runConfig.artifacts.size() < 1) { if (runConfig.artifacts.size() < 1) {
assert runConfig.artifacts : 'Error: No named artifacts to package!' assert runConfig.artifacts : 'Error: No named artifacts to package!'
} }

View File

@ -1,4 +1,12 @@
void call(String stepName, String boxColor = 'green', String textColor = 'white', String styleName = 'default') { void call(String stepName, Map styleMap = [:]) {
Map defaultStyleMap = [
boxColor: 'green',
textColor: 'white',
boxStyle: 'default'
]
runStyleMap = defaultStyleMap + styleMap
Map colors = [ Map colors = [
black: '\u001b[30m', black: '\u001b[30m',
red: '\u001b[31m', red: '\u001b[31m',
@ -30,7 +38,10 @@ void call(String stepName, String boxColor = 'green', String textColor = 'white'
] ]
] ]
Map style = boxStyles[styleName] String textColor = runStyleMap['textColor']
String boxColor = runStyleMap['boxColor']
Map style = boxStyles[runStyleMap['boxStyle']]
stepBanner = style['sd'] + " ${colors[textColor]}$stepName${colors['reset']}${colors[boxColor]} " + style['sd'] stepBanner = style['sd'] + " ${colors[textColor]}$stepName${colors['reset']}${colors[boxColor]} " + style['sd']
bannerWidth = stepName.length() + 6 bannerWidth = stepName.length() + 6