summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nix-script-diff-generations.sh (renamed from diff-generations.sh)0
-rw-r--r--nix-script.sh44
2 files changed, 44 insertions, 0 deletions
diff --git a/diff-generations.sh b/nix-script-diff-generations.sh
index 7553c0e..7553c0e 100644
--- a/diff-generations.sh
+++ b/nix-script-diff-generations.sh
diff --git a/nix-script.sh b/nix-script.sh
index da932c2..c50078b 100644
--- a/nix-script.sh
+++ b/nix-script.sh
@@ -10,3 +10,47 @@
# So the "diff-generations" script looks like a command for "nix-script"
#
+VERBOSE=0
+CONFIGFILE=~/.nixscriptsrc
+
+cmd="$1"; shift
+
+case $cmd in
+"--list-commands" )
+ LIST_COMMANDS=1
+ shift;
+ ;;
+
+"-l" )
+ LIST_COMMANDS=1
+ shift;
+ ;;
+
+"--config" )
+ CONFIGFILE=$1
+ shift
+ ;;
+
+"-c" )
+ CONFIGFILE=$1
+ shift
+ ;;
+
+"-v" )
+ export VERBOSE=1
+ shift;
+ ;;
+esac
+
+[[ ! -f $CONFIGFILE ]] && echo "No config file: '$CONFIGFILE'" && exit 1
+
+if [[ $LIST_COMMNADS -eq 1 ]]
+then
+ for cmd in $(all_commands)
+ do
+ echo "$cmd"
+ done
+ exit 0
+fi
+
+exec nixos-scripts-$cmd $*