aboutsummaryrefslogtreecommitdiff
path: root/bin/without-env
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-02-17 15:07:30 -0300
committerEuAndreh <eu@euandre.org>2023-02-17 15:07:32 -0300
commit44b1e103b4d3a24aee89587ef302891e9f9c3807 (patch)
treea8e4045218bd1075b687dd5a6f1d023e6c407bff /bin/without-env
parentetc/nix/configuration.nix: Add flutter2 and hover packages (diff)
downloaddotfiles-44b1e103b4d3a24aee89587ef302891e9f9c3807.tar.gz
dotfiles-44b1e103b4d3a24aee89587ef302891e9f9c3807.tar.xz
bin/: Use explicit "--" separator for assert-arg usages
In order to prevent legitimate cases to fail as errors, such as: NUM='-10' eval "$(assert-arg "$NUM" '-n NUM')" To prevent assert-arg(1) from treating "-10" as the options "-1 and -0, they need to be put after the "--" separator. This way, all usages of assert-arg(1) that had its first argument as a variable were adapted, and the usage and examples of assert-arg itself were updated to encourage this best practice.
Diffstat (limited to 'bin/without-env')
-rwxr-xr-xbin/without-env4
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/without-env b/bin/without-env
index fd9d1e8..57c2d2e 100755
--- a/bin/without-env
+++ b/bin/without-env
@@ -57,8 +57,8 @@ while getopts 'h' flag; do
done
shift $((OPTIND - 1))
-eval "$(assert-arg "${1:-}" 'ENVVAR')"
-eval "$(assert-arg "${2:-}" 'PATH')"
+eval "$(assert-arg -- "${1:-}" 'ENVVAR')"
+eval "$(assert-arg -- "${2:-}" 'PATH')"
eval "export $1=\"\$(echo \"\$$1\" | sed \"s|\$2:||g\")\""
shift # drop $1