fix: unstow shell

This commit is contained in:
hesam-init 2024-03-24 14:23:59 +03:30
parent 0be4dbf0d6
commit 3dcc61847b
2 changed files with 5 additions and 32 deletions

View file

@ -23,11 +23,11 @@ delete_symlinks() {
return 1
fi
for config in $source_dir/*; do
for config in "$source_dir"/* "$source_dir"/.*; do
config_name=$(basename $config)
target_config=$target_dir/$config_name
target_config="$target_dir/$config_name"
if [ -e $target_config ]; then
if [ -e "$target_config" ]; then
rm -rf $target_config
echo "Removed: $target_config"
else

31
stow.sh
View file

@ -29,7 +29,7 @@ stow_shortcuts() {
stow_dotfiles() {
create_symlinks $DOTFILES_DIR ~/.config
create_symlinks $SHELL_DIR ~/
create_symlinks $SHELL_DIR ~
log "Dotfiles stowed successfully!"
}
@ -47,35 +47,8 @@ stow() {
stow_hyprland
}
unstow_shell() {
for config in $SHELL_DIR/.*; do
if [ -f $config ]; then
local file_name=$(basename $config)
local target_file=~/$file_name
if [ -e $target_file ]; then
rm $target_file
echo "Removed: $target_file"
else
echo "Not found: $target_file"
fi
elif [ -d "$config" ]; then
local folder_name=$(basename $config)
local target_folder=~/$folder_name
if [ -e $target_folder ]; then
rm -rf $target_folder
echo "Removed: $target_folder"
else
echo "Not found: $target_folder"
fi
fi
done
}
unstow() {
unstow_shell
delete_symlinks $SHELL_DIR ~
delete_symlinks $DOTFILES_DIR ~/.config
delete_symlinks $SHORTCUTS_DIR ~/.local/share/applications
delete_symlinks $HYPRLAND_DIR ~/.config