inverted logic trap for dry runs
This commit is contained in:
parent
3987ccc007
commit
326833ae42
1 changed files with 8 additions and 7 deletions
15
functions
15
functions
|
|
@ -337,10 +337,11 @@ boxseparator(){
|
||||||
|
|
||||||
# For printing center-justified text. To change the padding character, replace the ' ' <~~ whitespace in front of the '{' in the padding variable
|
# For printing center-justified text. To change the padding character, replace the ' ' <~~ whitespace in front of the '{' in the padding variable
|
||||||
center() {
|
center() {
|
||||||
|
local _cmd=$@
|
||||||
local padding="";
|
local padding="";
|
||||||
padding="$(printf '%0.1s' \ {1..100})"
|
padding="$(printf '%0.1s' \ {1..100})"
|
||||||
#padding=" "
|
#padding=" "
|
||||||
printf '%*.*s %s %*.*s\n' 0 "$(((BOXWIDTH-2-${#1})/2))" "${padding}" "$1" 0 "$(((BOXWIDTH-1-${#1})/2))" "${padding}"
|
printf '%*.*s %s %*.*s\n' 0 "$(((BOXWIDTH-2-${#_cmd[@]})/2))" "${padding}" "$_cmd" 0 "$(((BOXWIDTH-1-${#_cmd})/2))" "${padding}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# For printing spanned text, e.g. single-pair lists ($name...$title)
|
# For printing spanned text, e.g. single-pair lists ($name...$title)
|
||||||
|
|
@ -423,19 +424,19 @@ logger(){
|
||||||
|
|
||||||
run(){
|
run(){
|
||||||
_cmd=$@
|
_cmd=$@
|
||||||
if [[ dry_run == true ]] ; then
|
if [[ $dry_run != true ]] ; then
|
||||||
boxline "DryRun: $_cmd"
|
|
||||||
else
|
|
||||||
$_cmd
|
$_cmd
|
||||||
|
else
|
||||||
|
boxline "DryRun: $_cmd"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
run-and-log(){
|
run-and-log(){
|
||||||
_cmd=$@
|
_cmd=$@
|
||||||
if [[ dry_run == true ]] ; then
|
if [[ $dry_run != true ]] ; then
|
||||||
logger "DryRun: $_cmd"
|
|
||||||
else
|
|
||||||
logger $_cmd
|
logger $_cmd
|
||||||
|
else
|
||||||
|
logger "DryRun: $_cmd"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue