Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add completion for trash-d #99

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions Completion/Darwin/Command/_trash

This file was deleted.

43 changes: 43 additions & 0 deletions Completion/Unix/Command/_trash
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#compdef trash

local variant

_pick_variant -r variant ali='(Rantakari|hasseg)' steven='(Steven|vanZyl)' other --version

case $variant in
ali)
# The hidden options here are options to rm that trash silently (and
# undocumentedly) ignores. Some options are not made mutually exclusive where
# they technically could be, for compatibility with aliases, etc.
_arguments -s -S -A '-*' : \
'!-'{d,f,i,r,P,R,W} \
'(: * -F -l -v)-e[empty trash]' \
'-F[use Finder instead of system API]' \
'(: * -e -F -s -y)-l[list items in trash]' \
'(: * -F -l -v)-s[securely empty trash]' \
'-v[increase output verbosity]' \
'-y[skip confirmation prompts (with -e or -s)]' \
'*: :_files'
return
;;
steven)
_arguments -s -S -A '-*' : \
mirsella marked this conversation as resolved.
Show resolved Hide resolved
'(-d --dir)'{-d,--dir}'[remove empty directories]' \
'(-r --recursive)'{-r,--recursive}'[delete directories and their contents]' \
mirsella marked this conversation as resolved.
Show resolved Hide resolved
'(-v --verbose)'{-v,--verbose}'[print more information]' \
'(-i --interactive -I --interactive-once -f --force)'{-i,--interactive}'[ask before each deletion]' \
'(-i --interactive -I --interactive-once -f --force)'{-I,--interactive-once}'[ask before deleting 3 or more files, or deleting recursively]' \
'(-i --interactive -I --interactive-once -f --force)'{-f,--force}'[don'\''t prompt and ignore errors]' \
'(- *)--version[output the version and exit]' \
'(- *)--list[list out the files in the trash]' \
'(- *)--orphans[list orphaned files in the trash]' \
'(- *)--restore[restore specified file from the trash]:trashed file:_files -W ${XDG_DATA_HOME\:-$HOME/.local/share}/Trash/files' \
mirsella marked this conversation as resolved.
Show resolved Hide resolved
'(- *)--delete[delete specified file from the trash]:trashed file:_files -W ${XDG_DATA_HOME\:-$HOME/.local/share}/Trash/files' \
'(- *)--empty[empty the trash bin]' \
'--rm[permanently delete specified file]' \
mirsella marked this conversation as resolved.
Show resolved Hide resolved
'(- *)'{-h,--help}'[diplay help information]' \
mirsella marked this conversation as resolved.
Show resolved Hide resolved
'*: :_files'
mirsella marked this conversation as resolved.
Show resolved Hide resolved
return
;;
*) _default ;;
esac