add trash-empty

This commit is contained in:
Mylloon 2024-11-04 17:22:51 +01:00
parent 45d4b73be3
commit 7bc526012d
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
4 changed files with 24 additions and 9 deletions

View file

@ -0,0 +1,18 @@
function trash --description "Empty the windows recycle bin."
# Get function name
set current_name $(status current-function)
# Check if no arguments were provided
if test -z $argv[1]
echo -e "Usage: $current_name"
return 0
end
# Empty trash
powershell.exe -Command "" \
"\$bin = (New-Object -ComObject Shell.Application).NameSpace(10);" \
"\$bin.items() | ForEach {" \
" Write-Host 'Deleting:' \$_.Name;" \
" Remove-Item \$_.Path -Recurse -Force;" \
"}"
end

View file

@ -36,12 +36,4 @@ function trash --description "Move file or directory to the windows recycle bin.
# Delete the WSL path # Delete the WSL path
rm -r "$element"; rm -r "$element";
# Empty trash (move to another function!)
# powershell.exe -Command "" \
# "\$bin = (New-Object -ComObject Shell.Application).NameSpace(10);" \
# "\$bin.items() | ForEach {" \
# " Write-Host 'Deleting:' \$_.Name;" \
# " Remove-Item \$_.Path -Recurse -Force;" \
# "}"
end end

View file

@ -179,6 +179,7 @@ sync-wsl:
@$(CURL) $(REPO_SRC)/.config/fish/conf.d/abbr_wsl.fish >> $(HOME)/.config/fish/conf.d/abbr.fish @$(CURL) $(REPO_SRC)/.config/fish/conf.d/abbr_wsl.fish >> $(HOME)/.config/fish/conf.d/abbr.fish
@$(CURL) $(REPO_SRC)/.config/fish/conf.d/alias_wsl.fish >> $(HOME)/.config/fish/conf.d/alias.fish @$(CURL) $(REPO_SRC)/.config/fish/conf.d/alias_wsl.fish >> $(HOME)/.config/fish/conf.d/alias.fish
@$(WGET) $(REPO_SRC)/.config/fish/functions/trash.fish -O $(HOME)/.config/fish/functions/trash.fish @$(WGET) $(REPO_SRC)/.config/fish/functions/trash.fish -O $(HOME)/.config/fish/functions/trash.fish
@$(WGET) $(REPO_SRC)/.config/fish/functions/trash-empty.fish -O $(HOME)/.config/fish/functions/trash-empty.fish
@echo "Fish specific settings synced!" @echo "Fish specific settings synced!"
@echo @echo

6
wsl.sh
View file

@ -83,7 +83,11 @@ function main {
curl -s ${repo}/.config/fish/conf.d/abbr_wsl.fish >> "$HOME"/.config/fish/conf.d/abbr.fish curl -s ${repo}/.config/fish/conf.d/abbr_wsl.fish >> "$HOME"/.config/fish/conf.d/abbr.fish
curl -s ${repo}/.config/fish/conf.d/alias_wsl.fish >> "$HOME"/.config/fish/conf.d/alias.fish curl -s ${repo}/.config/fish/conf.d/alias_wsl.fish >> "$HOME"/.config/fish/conf.d/alias.fish
# Specific WSL functions # Specific WSL functions
wget -q "${repo}"/.config/fish/functions/trash.fish -O "$HOME"/.config/fish/functions/trash.fish functions=("trash" "trash-empty")
for function in "${functions[@]}"
do
wget -q "${repo}"/.config/fish/functions/"${function}".fish -O "$HOME"/.config/fish/functions/"${function}".fish
done
# === OCaml == # === OCaml ==