mirror of
https://github.com/DictXiong/dotfiles.git
synced 2025-07-01 21:00:29 +08:00
feat(riot): print help when no argument or no remote
This commit is contained in:
parent
4e99cc1580
commit
70614af310
14
scripts/riot
14
scripts/riot
@ -264,11 +264,6 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
router() {
|
router() {
|
||||||
if [[ -z "$1" || "$1" == "-h" || "$1" == "--help" ]]; then
|
|
||||||
print_help
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
local positional=()
|
local positional=()
|
||||||
while [[ $# > 0 ]]; do
|
while [[ $# > 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@ -303,13 +298,14 @@ router() {
|
|||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
IFS=',' read -ra remotes <<< "${positional[0]}"
|
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
|
for i in ${!remotes[@]}; do
|
||||||
remote="${remotes[i]}"
|
remote="${remotes[i]}"
|
||||||
if [[ -z "$remote" ]]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
local batch_func="${remote}.batch"
|
local batch_func="${remote}.batch"
|
||||||
if is_function "$batch_func"; then
|
if is_function "$batch_func"; then
|
||||||
"$batch_func"
|
"$batch_func"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user