fix: stow utils

This commit is contained in:
hesam-init 2024-07-18 21:57:40 +03:30
parent 44560581d0
commit a4beed1e30
3 changed files with 12 additions and 4 deletions

View file

@ -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

@ -1 +1 @@
Subproject commit 8485498ac8a213f968cb7e18c8337814542fec70
Subproject commit 4a153019a337b308b72fc366e6314d3b2545c5da

View file

@ -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!"