Skip to content

Commit 78e7c94

Browse files
committed
feat(entrypoint): add --prj-root option
for specifying "$PRJ_ROOT" prior to sourcing "env.bash" (which will bail out if "$PRJ_ROOT" is unset or empty). Using "--prj-root" may be more convenient than setting an environment variable when, e.g., using the entrypoint as a Nix flake app.
1 parent 76aef52 commit 78e7c94

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

modules/devshell.nix

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,16 @@ let
114114
--pure)
115115
pure=1
116116
;;
117+
--prj-root)
118+
if (( "$#" < 2 )); then
119+
echo 1>&2 '${cfg.name}: missing required argument to --prj-root'
120+
exit 1
121+
fi
122+
123+
PRJ_ROOT="$2"
124+
125+
shift
126+
;;
117127
--)
118128
shift
119129
break
@@ -134,7 +144,8 @@ let
134144
$0 [--pure] <cmd> [...] # run a command in the environment
135145
136146
Options:
137-
* --pure : execute the script in a clean environment
147+
* --pure : execute the script in a clean environment
148+
* --prj-root <path> : set the project root (\$PRJ_ROOT)
138149
USAGE
139150
exit
140151
fi

0 commit comments

Comments
 (0)