From a4beed1e30d4cd325381f8a5dd28fa1fe23003c1 Mon Sep 17 00:00:00 2001 From: hesam-init Date: Thu, 18 Jul 2024 21:57:40 +0330 Subject: [PATCH] fix: stow utils --- .scripts/utils/_symlinks.sh | 10 +++++++--- linux-configs | 2 +- stow.sh | 4 ++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.scripts/utils/_symlinks.sh b/.scripts/utils/_symlinks.sh index d700c7e..869e1fc 100755 --- a/.scripts/utils/_symlinks.sh +++ b/.scripts/utils/_symlinks.sh @@ -4,11 +4,15 @@ create_links() { local source_dir=$1 local target_dir=$2 - if [ ! -d "$source_dir" ] || [ ! -d "$target_dir" ]; then - echo "Source or target directory does not exist." + if [ ! -d $source_dir ]; then + echo "Source directory does not exist." return 1 fi + if [ ! -d $target_dir ]; then + mkdir -p $target_dir + fi + for item in "$source_dir"/* "$source_dir"/.*; do if [ -e "$item" ] && [ "$item" != "$source_dir/." ] && [ "$item" != "$source_dir/.." ]; then echo "$item ===> $target_dir" @@ -21,7 +25,7 @@ delete_links() { local source_dir=$1 local target_dir=$2 - if [ ! -d "$source_dir" ] || [ ! -d "$target_dir" ]; then + if [ ! -d $source_dir ] || [ ! -d $target_dir ]; then echo "Source or target directory does not exist." return 1 fi diff --git a/linux-configs b/linux-configs index 8485498..4a15301 160000 --- a/linux-configs +++ b/linux-configs @@ -1 +1 @@ -Subproject commit 8485498ac8a213f968cb7e18c8337814542fec70 +Subproject commit 4a153019a337b308b72fc366e6314d3b2545c5da diff --git a/stow.sh b/stow.sh index 3b3317b..91ce428 100755 --- a/stow.sh +++ b/stow.sh @@ -7,6 +7,7 @@ DOTS_CONFIG_DIR="$(pwd)/linux-configs" DOTFILES_DIR="$DOTS_CONFIG_DIR/dotfiles" SHELL_DIR="$DOTS_CONFIG_DIR/shells/zsh" +FISH_DIR="$DOTS_CONFIG_DIR/shells/fish" EDITOR_DIR="$DOTS_CONFIG_DIR/editor/vim" @@ -34,6 +35,9 @@ stow() { create_links $SHELL_DIR ~ log "Shell stowed successfully!" + create_links $FISH_DIR ~/.config/fish + log "Fish Shell stowed successfully!" + create_links $EDITOR_DIR ~ log "Editor stowed successfully!"