From 4532c29ab3f943079744c8d6e6d5455f17f88802 Mon Sep 17 00:00:00 2001 From: Ken Matsui <26405363+ken-matsui@users.noreply.github.com> Date: Fri, 20 Dec 2024 17:41:50 -0500 Subject: [PATCH] Setup: customization with config.sh --- README.md | 2 +- setup/common/config.sh | 75 ++++++++++++++++++++++++++++-------------- 2 files changed, 52 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index fe63416..d7e944f 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ ```sh cd ~ git clone https://github.com/ken-matsui/dotfiles.git -./dotfiles/setup/common/config.sh +./dotfiles/setup/common/config.sh minimal ``` ### Full Installation (only on macOS or Manjaro Sway) diff --git a/setup/common/config.sh b/setup/common/config.sh index a1eb602..e3101b6 100755 --- a/setup/common/config.sh +++ b/setup/common/config.sh @@ -18,31 +18,58 @@ backup_and_link() { ln -s "$DOTSPATH/$1" "$TARGET" } +ALL=' +.config/alacritty +.config/atuin +.config/git +.config/neomutt +.config/nvim +.config/shell +.config/sway +.config/tmux +.config/topgrade +.config/vim +.config/w3m +.config/waybar +.config/starship.toml +.ssh +.Brewfile +.zshenv +.zshrc +' + +MINIMAL=' +.config/git +.config/nvim +.config/shell +.config/tmux +.config/vim +.config/starship.toml +.zshenv +.zshrc +' + +if [ "$#" -eq 0 ]; then + ITEMS="$ALL" +elif [ "$1" = 'minimal' ]; then + ITEMS="$MINIMAL" +else + ITEMS="$1" +fi + mkdir -p "$HOME/.config" -OS_NAME="$(uname -s)" -if [ "$OS_NAME" = Darwin ]; then - # TARGET=$HOME/Library/Application Support/Code - backup_and_link .config/Code "$HOME/Library/Application Support" -elif [ "$OS_NAME" = Linux ]; then - # TARGET=$HOME/.config/Code - backup_and_link .config/Code +if [ "$1" = 'all' ] || [ "$1" = '.config/Code' ]; then + OS_NAME="$(uname -s)" + if [ "$OS_NAME" = Darwin ]; then + # TARGET=$HOME/Library/Application Support/Code + backup_and_link .config/Code "$HOME/Library/Application Support" + elif [ "$OS_NAME" = Linux ]; then + # TARGET=$HOME/.config/Code + backup_and_link .config/Code + fi fi -backup_and_link .config/alacritty -backup_and_link .config/atuin -backup_and_link .config/git -backup_and_link .config/neomutt -backup_and_link .config/nvim -backup_and_link .config/shell -backup_and_link .config/sway -backup_and_link .config/tmux -backup_and_link .config/topgrade -backup_and_link .config/vim -backup_and_link .config/w3m -backup_and_link .config/waybar -backup_and_link .config/starship.toml -backup_and_link .ssh -backup_and_link .Brewfile -backup_and_link .zshenv -backup_and_link .zshrc +for item in $ITEMS; do + backup_and_link "$item" +done