From 70614af310e5f9f9d0a54066922ccb46bd6d0f98 Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Sat, 21 Jun 2025 05:39:39 +0800 Subject: [PATCH] feat(riot): print help when no argument or no remote --- scripts/riot | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/scripts/riot b/scripts/riot index 6465831..ea129e0 100755 --- a/scripts/riot +++ b/scripts/riot @@ -264,11 +264,6 @@ EOF } router() { - if [[ -z "$1" || "$1" == "-h" || "$1" == "--help" ]]; then - print_help - exit - fi - local positional=() while [[ $# > 0 ]]; do case "$1" in @@ -303,13 +298,14 @@ router() { esac shift done - IFS=',' read -ra remotes <<< "${positional[0]}" + for i in ${!remotes[@]}; do if [[ -z "${remotes[i]}" ]]; then unset remotes[i]; fi; done + if [[ "${#positional[@]}" == "0" || "${#remotes[@]}" == "0" ]]; then + print_help + exit 1 + fi for i in ${!remotes[@]}; do remote="${remotes[i]}" - if [[ -z "$remote" ]]; then - continue - fi local batch_func="${remote}.batch" if is_function "$batch_func"; then "$batch_func"