diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2015-02-06 16:31:23 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2015-02-06 20:31:48 +0100 |
commit | 653005f417ee0d650f99be8de39257d63367c068 (patch) | |
tree | 91eb1ca410ec48f03d7cb35380a9b0ca565a23e9 | |
parent | ce9be1bc31e5ff0a773ae6fa9125b80b42596985 (diff) |
Add stdout() function helper for printing in verbose mode
-rw-r--r-- | nix-script.sh | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/nix-script.sh b/nix-script.sh index a7d5905..2f5a7bb 100644 --- a/nix-script.sh +++ b/nix-script.sh @@ -24,10 +24,18 @@ usage() { EOS } +LIST_COMMANDS=0 +VERBOSE=0 +CONFIGFILE=~/.nixscriptsrc + stderr() { echo "[$(basename $0)]: $*" >&2 } +stdout() { + [ $VERBOSE -eq 1 ] && echo "[$(basename $0)]: $*" +} + script_for() { echo "$(dirname ${BASH_SOURCE[0]})/nix-script-${1}.sh" } @@ -46,10 +54,6 @@ all_commands() { find $(dirname ${BASH_SOURCE[0]}) -type f -name "nix-script-*.sh" } -LIST_COMMANDS=0 -VERBOSE=0 -CONFIGFILE=~/.nixscriptsrc - for cmd do case $cmd in @@ -139,4 +143,4 @@ fi SCRIPT_ARGS=$(shift_n $SHIFT_ARGS $*) -exec $SCRIPT $SCRIPT +exec $SCRIPT $SCRIPT_ARGS |