about summary refs log tree commit diff
path: root/Completion/Core/_files
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Core/_files')
-rw-r--r--Completion/Core/_files11
1 files changed, 5 insertions, 6 deletions
diff --git a/Completion/Core/_files b/Completion/Core/_files
index 471824bfe..506ddbc8e 100644
--- a/Completion/Core/_files
+++ b/Completion/Core/_files
@@ -3,10 +3,9 @@
 # Utility function for completing files of a given type or any file.
 # In many cases you will want to call this one instead of _path_files().
 
-local nm=$compstate[nmatches] ret
+local nm=$compstate[nmatches] ret=1
 
-_path_files "$@"
-ret=$?
+_path_files "$@" && ret=0
 
 if [[ $# -ne 0 && compstate[nmatches] -eq nm ]]; then
   local opt opts
@@ -23,7 +22,7 @@ if [[ $# -ne 0 && compstate[nmatches] -eq nm ]]; then
     [[ "$opt" = [PSWFJVX] ]] && opts=("$opts[@]" "-$opt" "$OPTARG")
   done
 
-  _path_files "$opts[@]"
-else
-  return $ret
+  _path_files "$opts[@]" && ret=0
 fi
+
+return ret