about summary refs log tree commit diff
path: root/Completion/Core/_files
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-04-15 18:05:38 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-04-15 18:05:38 +0000
commite74702b467171dbdafb56dfe354794a212e020d9 (patch)
treec295b3e9b2e93e2de10331877442615b0f37e779 /Completion/Core/_files
parentc175751b501a3a4cb40ad4787340a597ea769be4 (diff)
downloadzsh-e74702b467171dbdafb56dfe354794a212e020d9.tar.gz
zsh-e74702b467171dbdafb56dfe354794a212e020d9.tar.xz
zsh-e74702b467171dbdafb56dfe354794a212e020d9.zip
Initial revision
Diffstat (limited to 'Completion/Core/_files')
-rw-r--r--Completion/Core/_files26
1 files changed, 26 insertions, 0 deletions
diff --git a/Completion/Core/_files b/Completion/Core/_files
new file mode 100644
index 000000000..d2cce35e7
--- /dev/null
+++ b/Completion/Core/_files
@@ -0,0 +1,26 @@
+#autoload
+
+# 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=$NMATCHES
+
+_path_files "$@"
+
+if [[ $# -ne 0 && -nmatches nm ]]; then
+  local opt opts
+
+  # We didn't get any matches for those types of files described by
+  # the `-g' or `-/' option. Now we try it again accepting all files.
+  # First we get those options that we have to use even if then. If
+  # we find out that the `-f' option was given, we already accepted
+  # all files and give up immediatly.
+
+  opts=()
+  while getopts "P:S:W:F:J:V:X:f/g:" opt; do
+    [[ "$opt" = f ]] && return
+    [[ "$opt" = [PSWFJVX] ]] && opts=("$opts[@]" "-$opt" "$OPTARG")
+  done
+
+  _path_files "$opts[@]"
+fi