From e8765d076f8ea5d539c9a34be77185f9c771412c Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 14 Sep 2015 17:51:03 +0200 Subject: Add builtin: debugging --- nix-script-repl.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/nix-script-repl.sh b/nix-script-repl.sh index 2f7effb..423f410 100755 --- a/nix-script-repl.sh +++ b/nix-script-repl.sh @@ -85,6 +85,25 @@ __verbosity() { esac } +__debugging() { + case $1 in + on) + export DEBUG=1 + dbg "DEBUG = $DEBUG" + stdout "Debugging is now ON" + ;; + off) + export DEBUG=0 + dbg "DEBUG = $DEBUG" + stdout "Debugging is now ON" + ;; + *) + stderr "Unknown argument: $1" + stderr "Usage: debuggig [on|off]" + ;; + esac +} + __builtin__() { local str=$1; shift local cmd=$1; shift @@ -107,6 +126,7 @@ do __builtin__ "help" usage $ARGS || continue __builtin__ "list" __list $ARGS || continue __builtin__ "verbosity" __verbosity $ARGS || continue + __builtin__ "debugging" __debugging $ARGS || continue dbg "Got '$COMMAND' with args '$ARGS'" stdout "Searching for script for '$COMMAND'" -- cgit v1.2.3