install.sh: -H support multiple keys

This commit is contained in:
xiongdian.me 2023-02-01 17:08:56 +08:00
parent c475613744
commit d493ad9e2d
2 changed files with 9 additions and 3 deletions

View File

@ -19,8 +19,13 @@ main()
if [[ -z "$key" ]]; then if [[ -z "$key" ]]; then
fmt_fatal "missing key" fmt_fatal "missing key"
fi fi
local url="https://pastebin.com/raw/$key" IFS=',' read -r -a keys<<<"$key"
curl -fsSL "$url" | do_append for k in "${keys[@]}";do
if [[ -z "$k" ]]; then
continue
fi
curl -fsSL "https://pastebin.com/raw/$k" | do_append
done
} }
main "${GOT_OPTS[@]}" main "${GOT_OPTS[@]}"

View File

@ -48,8 +48,9 @@ test `git rev-parse HEAD` = `curl -fsSL https://api.beardic.cn/get-var/dfs-commi
git reset --hard $DFS_VERSION git reset --hard $DFS_VERSION
# then check install.sh # then check install.sh
./install.sh -dx DFS_CI=1 -H e153a2eL ./install.sh -dx DFS_CI=1 -H e153a2eL,f8At3iFw
grep -q "testhist 1" ~/.zsh_history grep -q "testhist 1" ~/.zsh_history
grep -q "testhist 4" ~/.zsh_history
grep -q "DFS_CI=1" ~/.config/dotfiles/env grep -q "DFS_CI=1" ~/.config/dotfiles/env
./install.sh -l -x DFS_CI=1 ./install.sh -l -x DFS_CI=1
dfs version dfs version