2005-09-20 21:31:55 +08:00
|
|
|
#Completions for rm
|
2018-04-02 04:42:38 +08:00
|
|
|
if rm --version >/dev/null 2>/dev/null # GNU
|
2017-10-12 01:17:35 +08:00
|
|
|
complete -c rm -s d -l directory -d "Unlink directory (Only by superuser)"
|
|
|
|
complete -c rm -s f -l force -d "Never prompt before removal"
|
|
|
|
complete -c rm -s i -l interactive -d "Prompt before removal"
|
|
|
|
complete -c rm -s I -d "Prompt before removing more than three files"
|
|
|
|
complete -c rm -s r -l recursive -d "Recursively remove subdirectories"
|
|
|
|
complete -c rm -s R -d "Recursively remove subdirectories"
|
|
|
|
complete -c rm -s v -l verbose -d "Explain what is done"
|
|
|
|
complete -c rm -s h -l help -d "Display help and exit"
|
|
|
|
complete -c rm -l version -d "Display version and exit"
|
2018-11-25 22:08:24 +08:00
|
|
|
else
|
|
|
|
set -l uname (uname -s)
|
|
|
|
# solaris: rm [-fi ] file ...
|
|
|
|
# openbsd: rm [-fidPRrv ] file ...
|
|
|
|
# macos: rm [-fidPRrvW ] file ...
|
|
|
|
# netbsd: rm [-fidPRrvWx ] file ...
|
|
|
|
# freebsd: rm [-fidPRrvWxI] file ...
|
|
|
|
# dragonfly: rm [-fidPRrvWxI] file ...
|
|
|
|
|
2015-11-27 18:28:41 +08:00
|
|
|
complete -c rm -s f -d "Never prompt before removal"
|
|
|
|
complete -c rm -s i -d "Prompt before removal"
|
2018-11-25 22:08:24 +08:00
|
|
|
test "$uname" = SunOS
|
|
|
|
and exit 0
|
|
|
|
complete -c rm -s d -d "Attempt to remove directories as well"
|
2015-11-27 18:28:41 +08:00
|
|
|
complete -c rm -s P -d "Overwrite before removal"
|
|
|
|
complete -c rm -s R -d "Recursively remove subdirectories"
|
2018-11-25 22:08:24 +08:00
|
|
|
complete -c rm -s r -d "Recursively remove subdirectories"
|
2015-11-27 18:28:41 +08:00
|
|
|
complete -c rm -s v -d "Explain what is done"
|
2018-11-25 22:08:24 +08:00
|
|
|
test "$uname" = OpenBSD
|
|
|
|
and exit 0
|
2015-11-27 18:28:41 +08:00
|
|
|
complete -c rm -s W -d "Undelete the named files"
|
2018-11-25 22:08:24 +08:00
|
|
|
test "$uname" = Darwin
|
|
|
|
and exit 0
|
|
|
|
complete -c rm -s x -d "Do not traverse filesystem mount points"
|
|
|
|
test "$uname" = NetBSD
|
|
|
|
and exit 0
|
|
|
|
complete -c rm -s I -d "Like -i, but only if 3 or more files affected"
|
2015-11-27 18:28:41 +08:00
|
|
|
end
|
2005-09-20 21:31:55 +08:00
|
|
|
|
|
|
|
|