From 9107900d644e6241eaf0e383d61ba05adff87ebf Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 4 Mar 2023 09:47:40 +0100 Subject: vim_solarized.sh: refactoring --- vim_solarized.sh | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/vim_solarized.sh b/vim_solarized.sh index fc5f20d..bb7ae77 100755 --- a/vim_solarized.sh +++ b/vim_solarized.sh @@ -4,14 +4,32 @@ set -o errexit -o nounset -o pipefail shopt -s inherit_errexit lastpipe plugins_dir="$HOME/.vim/pack/plugins/start" -name='vim-colors-solarized' +readonly plugins_dir -mkdir -p -- "$plugins_dir" -cd -- "$plugins_dir" +plugins=( + alteraction/vim-colors-solarized +) -if [ -d "$name" ]; then - cd -- "$name" - git pull -else - git clone "https://github.com/altercation/$name.git" -fi +pull() { + local plugin + for plugin in ${plugins[@]+"${plugins[@]}"}; do + echo "Plugin: $plugin" + + local name + name="${plugin#*/}" + + if [ -d "$name" ]; then + git -C "$name" pull + else + git clone "https://github.com/$plugin.git" + fi + done +} + +main() { + mkdir -p -- "$plugins_dir" + cd -- "$plugins_dir" + pull +} + +main -- cgit v1.2.3