about summary refs log tree commit diff
path: root/Completion/Unix/Command
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2003-02-21 11:01:19 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2003-02-21 11:01:19 +0000
commit4e6c75fa78552ae54bad3e0fa6eebc57bb0177d3 (patch)
treecf830473a489a561ab02ed056fab24018075490a /Completion/Unix/Command
parent945f54b00109f5abf4f64fef7388469364a3d70d (diff)
downloadzsh-4e6c75fa78552ae54bad3e0fa6eebc57bb0177d3.tar.gz
zsh-4e6c75fa78552ae54bad3e0fa6eebc57bb0177d3.tar.xz
zsh-4e6c75fa78552ae54bad3e0fa6eebc57bb0177d3.zip
18269: improve sccs file completion to handle both direct & indirect references
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r--Completion/Unix/Command/_sccs18
1 files changed, 13 insertions, 5 deletions
diff --git a/Completion/Unix/Command/_sccs b/Completion/Unix/Command/_sccs
index e4af91a97..ed0dd516d 100644
--- a/Completion/Unix/Command/_sccs
+++ b/Completion/Unix/Command/_sccs
@@ -2,10 +2,17 @@
 
 (( $+functions[_sccs_files] )) ||
 _sccs_files() {
-  local dir=${PROJECTDIR:-~+}/${PREFIX##*/}/$finalpath
-
-  compset -P '*/'
-  _files -W $dir -g \*\(:s/s.//\) "$@"
+  local dir expl ret=1 pref=$PREFIX ipref=$IPREFIX
+  dir="${(M)PREFIX##*/}$finalpath"
+  [[ $~dir = (.|..|)/* ]] || dir="${PROJECTDIR:-~+}/$dir"
+  compset -P "*/"
+  _wanted file expl file compadd "$@" - $~dir/*(N.:t:s/s.//) && ret=0
+  PREFIX="$pref"
+  IPREFIX="$ipref"
+  _wanted sccs-files expl 'sccs file' _files -W ${PROJECTDIR:-~+} \
+      -g 's.*' && ret=0
+  
+  return ret
 }
 
 local curcontext="$curcontext" state line
@@ -20,7 +27,7 @@ subcmds=(
 
 ropt='-r+[specify sccs delta id]:sccs delta id'
 copt='-c+[specify date]:date-stamp'
-sfiles=':file:_sccs_files'
+sfiles=":file:_files -g s.\*"
 
 if [[ $service = sccs ]]; then
   _arguments -C -A "-*" \
@@ -34,6 +41,7 @@ if [[ $service = sccs ]]; then
     return
   fi
   service="$words[1]"
+  sfiles=':file:_sccs_files'
   curcontext="${curcontext%:*}-$service:"
 fi
 finalpath="${opt_args[-p]:-SCCS}"