diff --git a/dot_config/private_fish/functions/rm.fish b/dot_config/private_fish/functions/rm.fish index 46da08c2..a77cdbab 100644 --- a/dot_config/private_fish/functions/rm.fish +++ b/dot_config/private_fish/functions/rm.fish @@ -1,7 +1,17 @@ -function rm --description 'map rm to gio trash' - if string match -q -- '-*' $argv[1] - set argv[1] (string replace -a 'r' '' -- $argv[1]) +function rm --description 'map rm to macOS trash' + set -l args + set -l opts 1 + + for arg in $argv + test $opts -eq 1; and test "$arg" = --; and set opts 0; and continue + test $opts -eq 1; and string match -q -- '-*' "$arg"; and continue + set -a args $arg + end + + test (count $args) -gt 0; or begin + command trash --help + return 1 end - gio trash $argv + command trash $args end diff --git a/private_dot_local/bin/executable_custom-update b/private_dot_local/bin/executable_custom-update index 2db25b35..8ec4f32c 100644 --- a/private_dot_local/bin/executable_custom-update +++ b/private_dot_local/bin/executable_custom-update @@ -17,12 +17,7 @@ execute "brew cleanup" "Cleanup brew" execute "nvim --headless -c 'autocmd User MasonUpdateAllComplete qall' -c 'MasonUpdateAll'" "Update Neovim Mason packages" -ask_for_confirmation "Remove macOS Trash and .local/share/Trash directories?" +ask_for_confirmation "Empty macOS Trash?" if answer_is_yes; then - if [[ -d "$HOME/.Trash" ]]; then - execute "rm -rf $HOME/.Trash/{*,.*}" "Empty macOS Trash" - fi - if [[ -d "$HOME/.local/share/Trash" ]]; then - execute "rm -rf $HOME/.local/share/Trash/{*,.*}" "Empty .local/share/Trash" - fi + execute "osascript -e 'tell application \"Finder\" to empty trash'" "Empty macOS Trash" fi