ArchSetupScripts/dots.sh
2024-11-10 08:58:16 -05:00

48 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
main(){
run_dotfiles_install;
}
_install_dotfiles(){
local out=$1; local url=$2; local post=$3;
bash ./warn.sh "Fetching $out ..."
if (curl "$url" -o "$out" --create-dirs);then
bash ./success.sh "Success: $out"
if [[ "$post" ]]; then
eval "$post"
fi
else
bash ./error.sh "Failed: $out"
fi
}
run_dotfiles_install(){
echo "########################### Dot Files #######################"
declare -A vim=(
["out"]="$HOME/.vimrc"
["url"]="http://git.klectr.dev/tristonarmstrong/dotfiles/raw/branch/main/.vimrc"
["post"]="vim -es -u vimrc -i NONE -c "PlugInstall" -c "qa"" # <-- runs pluginstall after
)
declare -A helix_config=(
["out"]="$HOME/.config/helix/config.toml"
["url"]="https://git.klectr.dev/tristonarmstrong/dotfiles/raw/branch/main/.config/helix/config.toml"
["post"]=""
)
declare -A helix_languages=(
["out"]="$HOME/.config/helix/languages.toml"
["url"]="https://git.klectr.dev/tristonarmstrong/dotfiles/raw/branch/main/.config/helix/languages.toml"
["post"]=""
)
dotfiles+=("vim" "helix_config" "helix_languages")
for tuple_name in "${dotfiles[@]}"; do
declare -n tuple="$tuple_name"
_install_dotfiles "${tuple["out"]}" "${tuple["url"]}" "${tuple["post"]}";
done;
}
main;