From 3574d15bca688b38f511adc8746cfc481a36d954 Mon Sep 17 00:00:00 2001 From: holly sparkles Date: Sun, 28 Apr 2024 20:55:00 +0200 Subject: [PATCH] update script to sync to repo and clean --- sync.zsh | 60 +++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 17 deletions(-) diff --git a/sync.zsh b/sync.zsh index 993862e..6c4acab 100755 --- a/sync.zsh +++ b/sync.zsh @@ -2,20 +2,46 @@ DOTFILES_DIR=. -# dir structure -mkdir -p "${DOTFILES_DIR}/.config/gtk-3.0" -mkdir -p "${DOTFILES_DIR}/.config/helix" -mkdir -p "${DOTFILES_DIR}/.config/kitty" -mkdir -p "${DOTFILES_DIR}/.config/zellij" -mkdir -p "${DOTFILES_DIR}/.scripts" - -# configs -cp -v $HOME/.zshrc $DOTFILES_DIR/.zshrc -cp -v $HOME/.config/gtk-3.0/gtk.css $DOTFILES_DIR/.config/gtk-3.0/gtk.css -cp -v $HOME/.config/helix/config.toml $DOTFILES_DIR/.config/helix/config.toml -cp -v $HOME/.config/kitty/kitty.conf $DOTFILES_DIR/.config/kitty/kitty.conf -cp -vr $HOME/.config/zellij/ $DOTFILES_DIR/.config/ - -# scripts -cp -v $SCRIPTS/calendar.sh $DOTFILES_DIR/.scripts/calendar.sh -cp -v $SCRIPTS/zellij-launcher.zsh $DOTFILES_DIR/.scripts/zellij-launcher.zsh +sync() { + # dir structure + mkdir -p "${DOTFILES_DIR}/.config/gtk-3.0" + mkdir -p "${DOTFILES_DIR}/.config/helix" + mkdir -p "${DOTFILES_DIR}/.config/kitty" + mkdir -p "${DOTFILES_DIR}/.config/zellij" + mkdir -p "${DOTFILES_DIR}/.scripts" + + # configs + cp -v $HOME/.zshrc $DOTFILES_DIR/.zshrc + cp -v $HOME/.config/gtk-3.0/gtk.css $DOTFILES_DIR/.config/gtk-3.0/gtk.css + cp -v $HOME/.config/helix/config.toml $DOTFILES_DIR/.config/helix/config.toml + cp -v $HOME/.config/kitty/kitty.conf $DOTFILES_DIR/.config/kitty/kitty.conf + cp -vr $HOME/.config/zellij/ $DOTFILES_DIR/.config/ + + # scripts + cp -v $SCRIPTS/calendar.sh $DOTFILES_DIR/.scripts/calendar.sh + cp -v $SCRIPTS/zellij-launcher.zsh $DOTFILES_DIR/.scripts/zellij-launcher.zsh + + echo "done." +} + +clean() { + # dirs + rm -rfv "${DOTFILES_DIR}/.config" + rm -rfv "${DOTFILES_DIR}/.scripts" + + # files + rm -fv "${DOTFILES_DIR}/.zshrc" +} + +main() { + if [[ "$1" == "clean" ]]; then + clean + else + sync + fi + + echo "goodbye." + exit 0 +} + +main "$@" -- libgit2 1.7.2