summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2015-09-14 17:51:03 +0200
committerMatthias Beyer <mail@beyermatthias.de>2015-09-14 17:51:03 +0200
commite8765d076f8ea5d539c9a34be77185f9c771412c (patch)
tree1c5a4e13fa7dc9abddad10b794b84598226989ce
parentb45020be34521d053c700441f96b0bf136aab3dc (diff)
Add builtin: debugging
-rwxr-xr-xnix-script-repl.sh20
1 files changed, 20 insertions, 0 deletions
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'"