about summary refs log tree commit diff
path: root/nixpkgs/pkgs/build-support/rust/build-rust-crate/log.nix
blob: 25181c787e2c08801dbf1b246d6d923ab519cd53 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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 $@
  	  ''}
  	  $@
    }
  '';
}