feat(riot): better help and fix option quite->quiet

This commit is contained in:
Dict Xiong
2026-08-13 14:28:36 +08:00
parent 8660bf2f02
commit aa5c2e86b6
3 changed files with 103 additions and 21 deletions

View File

@@ -18,7 +18,7 @@ if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then
ARG="$1"; shift;
fi
case $ARG in
-q*|--quite ) export DFS_QUIET=1 ;;
-q*|--quiet ) export DFS_QUIET=1 ;;
-l*|--lite ) export DFS_LITE=1 ;;
-d*|--dev ) export DFS_DEV=1; set -x ;;
-D*|--dry-run ) export DFS_DRY_RUN=1 ;;

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -ex
OPTS='-a -bcl --color --arg1=1 --arg2 2 " 1 2" yes'
OPTS='-a -bcl --color --quiet --arg1=1 --arg2 2 " 1 2" yes'
TARGET_OPTS='-a -b -c --arg1 1 --arg2 2 1 2 yes'
eval set -- $OPTS
@@ -8,14 +8,14 @@ THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
source "$THIS_DIR/common.sh"
test "${GOT_OPTS[*]}" = "$TARGET_OPTS"
test $# -eq 8
test $# -eq 9
test "$*" = "${OPTS//\"/}"
test "$DFS_LITE" = "1"
is_tty
test -z "$DFS_QUIET"
test "$DFS_QUIET" = "1"
set +x
echo "test passed, args:"
for i in "${GOT_OPTS[@]}"; do
echo "$i"
done
done