diff options
Diffstat (limited to 'pkgs/build-support/rust/build-rust-crate/log.nix')
-rw-r--r-- | pkgs/build-support/rust/build-rust-crate/log.nix | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/pkgs/build-support/rust/build-rust-crate/log.nix b/pkgs/build-support/rust/build-rust-crate/log.nix new file mode 100644 index 00000000000..25181c787e2 --- /dev/null +++ b/pkgs/build-support/rust/build-rust-crate/log.nix @@ -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 $@ + ''} + $@ + } + ''; +} |