Warn when use flake receives a flag for the first argument

This commit is contained in:
cydparser 2023-08-06 14:18:14 -07:00
parent 1571256f62
commit aeade6d235

View file

@ -195,6 +195,14 @@ use_flake() {
flake_expr="${1:-.}"
flake_dir="${flake_expr%#*}"
if [[ "$flake_expr" =~ ^-[^#]*$ ]]; then
if [[ -n "$2" ]]; then
log_status "nix-direnv: the first argument must be a flake expression"
else
log_status "nix-direnv: the first argument must be a flake expression. did you mean 'use flake . $1'?"
fi
fi
local files_to_watch
files_to_watch=(".envrc" "$HOME/.direnvrc" "$HOME/.config/direnv/direnvrc")