From 44b1e103b4d3a24aee89587ef302891e9f9c3807 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 17 Feb 2023 15:07:30 -0300 Subject: 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. --- bin/vm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'bin/vm') diff --git a/bin/vm b/bin/vm index bfd182a..2296f72 100755 --- a/bin/vm +++ b/bin/vm @@ -214,7 +214,7 @@ write_ssh_config ACTION="${1:-}" OS="${2:-}" -eval "$(assert-arg "$ACTION" 'ACTION')" +eval "$(assert-arg -- "$ACTION" 'ACTION')" shift @@ -247,7 +247,7 @@ case "$ACTION" in done ;; up) - eval "$(assert-arg "$OS" 'OS')" + eval "$(assert-arg -- "$OS" 'OS')" shift if [ "${1:-}" = '--' ]; then shift @@ -301,7 +301,7 @@ case "$ACTION" in write_ssh_config ;; down) - eval "$(assert-arg "$OS" 'OS')" + eval "$(assert-arg -- "$OS" 'OS')" shift if [ "${1:-}" = '--' ]; then shift -- cgit v1.2.3