From 9801ebe6f527b9505799ff423c427c03694d85de Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 1 Oct 2015 01:40:17 +0200 Subject: prefix autoargs with current- and never add -name --- get | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/get b/get index 5a8f252..4fe8939 100755 --- a/get +++ b/get @@ -4,7 +4,7 @@ # get - evaluate ./default.nix # # SYNOPSIS -# get [-jlprs] [attrPath] +# get [-jlprs] [--show-trace] [attrPath] # # DESCRIPTION # The command nix evaluates the Nix expression in ./default.nix. @@ -24,6 +24,9 @@ # -s Recursively evaluate list elements and attributes. # Refs nix-instantiate(1)'s --strict. # +# --show-trace +# Refs nix-instantiate(1)'s --show-trace. +# set -efu args=$* @@ -61,6 +64,10 @@ if has_sopt s; then strict=1 fi +if has_lopt show-trace; then + show_trace=1 +fi + if x=$(nix-instantiate --json --eval -A NIX_PATH 2>/dev/null); then NIX_PATH=$(echo "$x" | jq -r .) @@ -69,19 +76,22 @@ if x=$(nix-instantiate --json --eval -A NIX_PATH 2>/dev/null); then fi result=$(nix-instantiate \ - --eval \ - --argstr user-name "$LOGNAME" \ - --argstr host-name "$HOSTNAME" \ ${json+--json} \ + ${show_trace+--show-trace} \ ${strict+--strict} \ + --eval \ $( for i; do echo "$i" done | sed -n ' s/^[A-Za-z_][0-9A-Za-z_./-]*$/--attr &/p - s/^\([0-9A-Za-z-]\+\)=\([0-9A-Za-z-]*\)$/--argstr \1-name \2/p + s/^\([0-9A-Za-z-]\+\)=\([.0-9A-Za-z-]*\)$/--argstr \1 \2/p ' - )) + ) \ + --argstr current-date "$(date -Is)" \ + --argstr current-host-name "$HOSTNAME" \ + --argstr current-user-name "$LOGNAME" \ +) case ${raw_output-0} in 1) case ${result:0:1} in \") -- cgit v1.2.3