#!/bin/bash only_backup=false only_commit=false show_help() { echo "Usage: $0 [--help|-h show help] [--only-commit]" echo "Options:" echo " --only-commit Makes the script only create a commit" echo " --help|h Display this message" } while [[ $# -gt 0 ]]; do case "$1" in --help|-h) show_help exit 0 ;; --only-backup) only_backup=true shift ;; --only-commit) only_commit=true shift ;; *) echo "Error: Unknown option '$1'" show_help exit 1 ;; esac done if [ "$only_backup" = true ] && [ "$only_commit" = true ]; then echo "Error: Cannot use both --only-backup and --only-commit together." exit 1 fi if [ "$only_commit" = false ]; then mkdir --parents dot-conf mkdir --parents dot-conf/.config/lvim mkdir --parents dot-conf/.tmuxifier/layouts mkdir --parents dot-conf/zellij mkdir --parents others cp ${HOME}/.zshrc ./dot-conf/ cp ${HOME}/.tmux.conf ./dot-conf/ cp --recursive ${HOME}/.config/lvim/* ./dot-conf/.config/lvim cp --recursive ${HOME}/.tmuxifier/layouts/* ./dot-conf/.tmuxifier/layouts/ cp --recursive ${HOME}/.config/zellij/* ./dot-conf/zellij/ cp --parents /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme ./others fi if [ "$only_backup" = false ]; then fulltime=$(date +%y-%m-%d-%H-%M-%S) git add . git commit -m "Devboot update: ${fulltime}" fi