The expression is already long and confusing enough without the color stuff sprinkled in. Moving it to a dedicated file makes sense. I switched a bit of the color support code to pure Nix since there wasn't much point in doing that in bash while we can just do it in Nix.wip/yesman
parent
0aac0e8d2c
commit
50b2ef28f7
@ -0,0 +1,33 @@ |
||||
{ lib }: |
||||
{ |
||||
echo_build_heading = colors: '' |
||||
echo_build_heading() { |
||||
start="" |
||||
end="" |
||||
${lib.optionalString (colors == "always") '' |
||||
start="$(printf '\033[0;1;32m')" #set bold, and set green. |
||||
end="$(printf '\033[0m')" #returns to "normal" |
||||
''} |
||||
if (( $# == 1 )); then |
||||
echo "$start""Building $1""$end" |
||||
else |
||||
echo "$start""Building $1 ($2)""$end" |
||||
fi |
||||
} |
||||
''; |
||||
noisily = colors: verbose: '' |
||||
noisily() { |
||||
start="" |
||||
end="" |
||||
${lib.optionalString (colors == "always") '' |
||||
start="$(printf '\033[0;1;32m')" #set bold, and set green. |
||||
end="$(printf '\033[0m')" #returns to "normal" |
||||
''} |
||||
${lib.optionalString verbose '' |
||||
echo -n "$start"Running "$end" |
||||
echo $@ |
||||
''} |
||||
$@ |
||||
} |
||||
''; |
||||
} |
Loading…
Reference in new issue