diff --git a/.config/yadm/auto.sh b/.config/yadm/auto.sh new file mode 100755 index 00000000..09d91eb8 --- /dev/null +++ b/.config/yadm/auto.sh @@ -0,0 +1,23 @@ +# Add individual files, ignoring symlinks +[ ! -L "$HOME/.zshrc" ] && yadm add "$HOME/.zshrc" + +# Directory navigation +cd "$HOME/.config/" || exit + +# List of config directories/files to add +# TODO: add these to a text file instead and read from it for easy appending +# could add a yadm alias to append stuff to this file? +configs=(nvim btop dunst i3 kitty lazygit nushell polybar rofi tmux wal zathura starship.toml yadm) + +# Loop through each item in configs array +for config in "${configs[@]}"; do + # Check if it's not a symlink before adding + # [ ! -L "$config" ] && [ -n "$(find "$config" -type l)" ] && yadm add "$config" + find "$config" -type f -exec yadm add {} + +done + +# Commit and push if there are changes +if [[ -n $(yadm status --porcelain) ]]; then + yadm commit -m "Auto commit: $(date +'%Y-%m-%d %H:%M:%S')" + yadm push +fi