Fix unbound shell variable errors on strict mode

This commit is contained in:
Joaquín Triñanes 2024-08-20 14:25:35 +02:00
parent cff4f3cb0f
commit aff76f86fe
No known key found for this signature in database
GPG key ID: 6E1446DD451C6BAF

View file

@ -253,7 +253,7 @@ use_flake() {
if [[ $flake_expr == -* ]]; then if [[ $flake_expr == -* ]]; then
local message="the first argument must be a flake expression" local message="the first argument must be a flake expression"
if [[ -n $2 ]]; then if [[ -n ${2:-} ]]; then
_nix_direnv_error "$message" _nix_direnv_error "$message"
return 1 return 1
else else
@ -408,15 +408,15 @@ use_nix() {
# ignore them # ignore them
;; ;;
--include | -I) --include | -I)
extra_args+=("$i" "$1") extra_args+=("$i" "${1:-}")
shift shift
;; ;;
--attr | -A) --attr | -A)
attribute="$1" attribute="${1:-}"
shift shift
;; ;;
--option | -o | --arg | --argstr) --option | -o | --arg | --argstr)
extra_args+=("$i" "$1" "$2") extra_args+=("$i" "${1:-}" "${2:-}")
shift shift
shift shift
;; ;;