From a8a9ac0dae54bc83399f5354e8d11aacba6779ff Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Fri, 27 Nov 2015 11:28:41 +0100 Subject: [PATCH] Add completion for OSX rm As always, this not only doesn't support longopts, but also has some options that GNU rm doesn't - in this case, an undelete function. --- share/completions/rm.fish | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/share/completions/rm.fish b/share/completions/rm.fish index 4184d6a97..93fc55bbd 100644 --- a/share/completions/rm.fish +++ b/share/completions/rm.fish @@ -1,11 +1,23 @@ #Completions for rm -complete -c rm -s d -l directory --description "Unlink directory (Only by superuser)" -complete -c rm -s f -l force --description "Never prompt before removal" -complete -c rm -s i -l interactive --description "Prompt before removal" -complete -c rm -s r -l recursive --description "Recursively remove subdirectories" -complete -c rm -s R --description "Recursively remove subdirectories" -complete -c rm -s v -l verbose --description "Explain what is done" -complete -c rm -s h -l help --description "Display help and exit" -complete -c rm -l version --description "Display version and exit" +if rm --version >/dev/null ^/dev/null # GNU + complete -c rm -s d -l directory --description "Unlink directory (Only by superuser)" + complete -c rm -s f -l force --description "Never prompt before removal" + complete -c rm -s i -l interactive --description "Prompt before removal" + complete -c rm -s I --description "Prompt before removing more than three files" + complete -c rm -s r -l recursive --description "Recursively remove subdirectories" + complete -c rm -s R --description "Recursively remove subdirectories" + complete -c rm -s v -l verbose --description "Explain what is done" + complete -c rm -s h -l help --description "Display help and exit" + complete -c rm -l version --description "Display version and exit" +else # OSX + complete -c rm -s d -d "Attempt to remove directories as well" + complete -c rm -s f -d "Never prompt before removal" + complete -c rm -s i -d "Prompt before removal" + complete -c rm -s P -d "Overwrite before removal" + complete -c rm -s r -d "Recursively remove subdirectories" + complete -c rm -s R -d "Recursively remove subdirectories" + complete -c rm -s v -d "Explain what is done" + complete -c rm -s W -d "Undelete the named files" +end