about summary refs log tree commit diff
path: root/Completion/Unix/Type/_dir_list
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-06-13 11:05:51 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-06-13 11:05:51 +0000
commit71a9847d48bcbcc4348b89d5fa1673496201f416 (patch)
tree8122c3b3c2531d0dc8cc4d6a21c280b0f3afa00a /Completion/Unix/Type/_dir_list
parent1bb5d4d3850dd3cc58979baccefbba400662f8b7 (diff)
downloadzsh-71a9847d48bcbcc4348b89d5fa1673496201f416.tar.gz
zsh-71a9847d48bcbcc4348b89d5fa1673496201f416.tar.xz
zsh-71a9847d48bcbcc4348b89d5fa1673496201f416.zip
fix for comparguments (completing after single letter options that get their argument in the next word); make _values ignore some of the standard option it may get; make _mount use _dir_list in some places and improve that; `document' comparguments and compvalues with some comments in computil.c (14897)
Diffstat (limited to 'Completion/Unix/Type/_dir_list')
-rw-r--r--Completion/Unix/Type/_dir_list28
1 files changed, 24 insertions, 4 deletions
diff --git a/Completion/Unix/Type/_dir_list b/Completion/Unix/Type/_dir_list
index 122d7ad94..ecd7c73da 100644
--- a/Completion/Unix/Type/_dir_list
+++ b/Completion/Unix/Type/_dir_list
@@ -1,7 +1,27 @@
 #autoload
 
-local suf
+# options:
+#  -s <sep> to specify the separator (default is a colon)
+#  -S       to say that the separator should be added as a suffix (instead
+#           of the default slash)
 
-compset -P '*:'
-compset -S ':*' || suf=":"
-_files -S "$suf" -r ': \t\t\-' -/
+local sep=: dosuf suf
+
+while [[ "$1" = -(s*|S) ]]; do
+  case "$1" in
+  -s)  sep="$2"; shift 2;;
+  -s*) sep="${1[3,-1]}"; shift;;
+  -S)  dosuf=yes; shift;;
+  esac
+done
+
+compset -P "*${sep}"
+compset -S "${sep}*" || suf="$sep"
+
+if [[ -n "$dosuf" ]]; then
+  suf=(-S "$suf")
+else
+  suf=()
+fi
+
+_files "$suf[@]" -r "${sep}"' /\t\t\-' -/ "$@"