From d493ad9e2d9bd759c5dfc5e1e8c80d548abb13f4 Mon Sep 17 00:00:00 2001 From: "xiongdian.me" Date: Wed, 1 Feb 2023 17:08:56 +0800 Subject: [PATCH] install.sh: -H support multiple keys --- tools/append_zsh_hist.sh | 9 +++++++-- tools/test.zsh | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/append_zsh_hist.sh b/tools/append_zsh_hist.sh index 12504c0..071295f 100755 --- a/tools/append_zsh_hist.sh +++ b/tools/append_zsh_hist.sh @@ -19,8 +19,13 @@ main() if [[ -z "$key" ]]; then fmt_fatal "missing key" fi - local url="https://pastebin.com/raw/$key" - curl -fsSL "$url" | do_append + IFS=',' read -r -a keys<<<"$key" + for k in "${keys[@]}";do + if [[ -z "$k" ]]; then + continue + fi + curl -fsSL "https://pastebin.com/raw/$k" | do_append + done } main "${GOT_OPTS[@]}" \ No newline at end of file diff --git a/tools/test.zsh b/tools/test.zsh index 4ac0fed..5658697 100644 --- a/tools/test.zsh +++ b/tools/test.zsh @@ -48,8 +48,9 @@ test `git rev-parse HEAD` = `curl -fsSL https://api.beardic.cn/get-var/dfs-commi git reset --hard $DFS_VERSION # 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 4" ~/.zsh_history grep -q "DFS_CI=1" ~/.config/dotfiles/env ./install.sh -l -x DFS_CI=1 dfs version