From 9f084fcd32c05c8618f1c803e3a49ebb4630d70a Mon Sep 17 00:00:00 2001 From: rhiannon morris Date: Fri, 20 May 2022 16:50:24 +0200 Subject: [PATCH] full disclosure i have never used c-style getopt before --- bin/nd | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/nd b/bin/nd index 5e6b3a2..45cac96 100755 --- a/bin/nd +++ b/bin/nd @@ -2,12 +2,16 @@ importas -D /bin/bash default_shell SHELL -elgetopt s +elgetopt s: importas -D $default_shell shell ELGETOPT_s elgetpositionals getcwd -E cwd -backtick -E nixdir { find-parent -d flake.nix } +backtick -D "" -E nixdir { find-parent -d flake.nix } +ifelse { test $nixdir = "" } { + foreground { echo "flake.nix not found in parents of ${cwd}" } + exit 1 +} cd $nixdir nix develop $@ -c execlineb -c "cd ${cwd} ${shell}"