about summary refs log tree commit diff
path: root/Completion/User
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/User')
-rw-r--r--Completion/User/.distfiles6
-rw-r--r--Completion/User/_chown15
-rw-r--r--Completion/User/_dd5
-rw-r--r--Completion/User/_find6
-rw-r--r--Completion/User/_groups6
-rw-r--r--Completion/User/_make24
-rw-r--r--Completion/User/_mh6
-rw-r--r--Completion/User/_rlogin2
-rw-r--r--Completion/User/_x_options6
9 files changed, 60 insertions, 16 deletions
diff --git a/Completion/User/.distfiles b/Completion/User/.distfiles
index ee0017035..07fddc134 100644
--- a/Completion/User/.distfiles
+++ b/Completion/User/.distfiles
@@ -1,6 +1,6 @@
 DISTFILES_SRC='
     .distfiles
-    _a2ps _compress _configure _dd _dvi _find _gunzip _gzip _hosts
-    _make _man _mh _pdf _ps _rcs _rlogin _strip _stty _tar _tar_archive
-    _tex _uncompress _x_options _xfig 
+    _a2ps _chown _compress _configure _dd _dvi _find _groups _gunzip _gzip
+    _hosts _make _man _mh _pdf _ps _rcs _rlogin _strip _stty
+    _tar _tar_archive _tex _uncompress _x_options _xfig 
 '
diff --git a/Completion/User/_chown b/Completion/User/_chown
new file mode 100644
index 000000000..1ec76b39e
--- /dev/null
+++ b/Completion/User/_chown
@@ -0,0 +1,15 @@
+#compdef chown chgrp
+
+if [[ CURRENT -eq 2 || CURRENT -eq 3 && $words[CURRENT-1] = -* ]]; then
+  if [[ $words[1] = chgrp ]] || compset -P '*[:.]'; then
+    _groups
+  else
+    if [[ $OSTYPE = (solaris*|hpux*) ]]; then
+      compgen -u -S ':' -q
+    else
+      compgen -u -S '.' -q
+    fi
+  fi
+else
+  _files
+fi
diff --git a/Completion/User/_dd b/Completion/User/_dd
index 6094d60b7..e57074520 100644
--- a/Completion/User/_dd
+++ b/Completion/User/_dd
@@ -4,10 +4,9 @@ if compset -P 1 'conv\='; then
   # If there's a comma present, ignore up to the last one.  The
   # test alone will have that effect.
   compset -p '*,'
-  compgen -S, -q \
-      -k '(ascii ebcdic ibm block unblock lcase ucase swab noerror sync)'
+  compadd -qS, -q ascii ebcdic ibm block unblock lcase ucase swab noerror sync
 elif compset -P 1 '[io]f\='; then
   _files
 else
-  compgen -S '=' -k '(if of ibs obs bs cbs skip files seek count conv)'
+  compadd -S '=' if of ibs obs bs cbs skip files seek count conv
 fi
diff --git a/Completion/User/_find b/Completion/User/_find
index dd00b0ed1..de8c3bff9 100644
--- a/Completion/User/_find
+++ b/Completion/User/_find
@@ -5,10 +5,10 @@ local prev="$words[CURRENT-1]"
 if compset -N '-(ok|exec)' '\;'; then
   _normal
 elif compset -P 1 -; then
-  compgen -s 'daystart {max,min,}depth follow noleaf version xdev \
+  compadd daystart {max,min,}depth follow noleaf version xdev \
     {a,c,}newer {a,c,m}{min,time} empty false {fs,x,}type gid inum links \
     {i,}{l,}name {no,}{user,group} path perm regex size true uid used \
-    exec {f,}print{f,0,} ok prune ls'
+    exec {f,}print{f,0,} ok prune ls
 elif [[ CURRENT -eq 2 ]]; then
   local ret=1
 
@@ -19,7 +19,7 @@ elif [[ CURRENT -eq 2 ]]; then
 elif [[ "$prev" = -((a|c|)newer|fprint(|0|f)) ]]; then
   _files
 elif [[ "$prev" = -fstype ]]; then
-  compgen -k '(ufs 4.2 4.3 nfs tmp mfs S51K S52K)'
+  compadd ufs 4.2 4.3 nfs tmp mfs S51K S52K
 elif [[ "$prev" = -group ]]; then
   compgen -k groups
 elif [[ "$prev" = -user ]]; then
diff --git a/Completion/User/_groups b/Completion/User/_groups
new file mode 100644
index 000000000..975189174
--- /dev/null
+++ b/Completion/User/_groups
@@ -0,0 +1,6 @@
+#compdef newgrp
+
+: ${(A)groups:=${${(s: :)$(</etc/group)}%%:*}}
+# : ${(A)groups:=${${(s: :)$(ypcat group.byname)}%%:*}} # If you use NIS
+
+compadd $groups
diff --git a/Completion/User/_make b/Completion/User/_make
index 4770c0d7a..add58dbf0 100644
--- a/Completion/User/_make
+++ b/Completion/User/_make
@@ -1,4 +1,24 @@
 #compdef make gmake pmake
 
-compgen -s "\$(awk '/^[a-zA-Z0-9][^\/ 	]+:/ {print \$1}' FS=: [mM]akefile /dev/null)" ||
-_files
+local prev="$words[CURRENT-1]" file ret=1
+
+if [[ "$prev" = -[CI] ]]; then
+  _files -/
+elif [[ "$prev" = -[foW] ]]; then
+  _files
+else
+  file="$words[(I)-f]"
+  if (( file )); then
+    file="$words[file+1]"
+  elif [[ -e Makefile ]]; then
+    file=Makefile
+  elif [[ -e makefile ]]; then
+    file=makefile
+  else
+    file=''
+  fi
+
+  [[ -n "$file" ]] &&
+    compadd - $(awk '/^[a-zA-Z0-9][^/ 	]+:/ {print $1}' FS=: $file) && ret=0
+  (( ret )) && _files
+fi
diff --git a/Completion/User/_mh b/Completion/User/_mh
index e228d31b0..f03e3d827 100644
--- a/Completion/User/_mh
+++ b/Completion/User/_mh
@@ -23,7 +23,7 @@ if compset -P 1 -; then
     print $n =~ s/^\[([a-z]+)\]// ? "$n\n$1$n\n" : "$n\n";
   }')
   return
-elif compset -P 1 '[+@] || [ "$prev" = -draftfolder ]]; then
+elif compset -P 1 '[+@]' || [[ "$prev" = -draftfolder ]]; then
   # Complete folder names.
   local mhpath
 
@@ -39,7 +39,7 @@ elif compset -P 1 '[+@] || [ "$prev" = -draftfolder ]]; then
 elif [[ "$prev" = -(editor|(whatnow|rmm|show|more)proc) ]]; then
   compgen -c
 elif [[ "$prev" = -file ]]; then
-  compgen -f
+  _files
 elif [[ "$prev" = -(form|audit|filter) ]]; then
   # Need some MH template file, which may be in our own MH directory
   # or with the standard library.
@@ -69,7 +69,7 @@ else
     # leaving foldnam empty works here
   fi
 
-  compgen -s '$(mark $foldnam 2>/dev/null | awk -F: '\''{ print $1 }'\'')' &&
+  compadd $(mark $foldnam 2>/dev/null | awk -F: '{ print $1 }') &&
       ret=0
   compadd reply next cur prev first last all unseen && ret=0
   compgen -W folddir -g '<->' && ret=0
diff --git a/Completion/User/_rlogin b/Completion/User/_rlogin
index 9f5f3d628..b792ba0d1 100644
--- a/Completion/User/_rlogin
+++ b/Completion/User/_rlogin
@@ -3,7 +3,7 @@
 if [[ CURRENT -eq 2 ]]; then
   compgen -k hosts
 elif [[ CURRENT -eq 3 ]]; then
-  compgen -k '(-l)'
+  compadd - -l
 else
   compgen -u
 fi
diff --git a/Completion/User/_x_options b/Completion/User/_x_options
index cd45c87f6..a9c18b0d1 100644
--- a/Completion/User/_x_options
+++ b/Completion/User/_x_options
@@ -2,4 +2,8 @@
 
 # A simple pattern completion, just as an example.
 
-compgen -J options -k '(-display -name -xrm)'
+if [ "$words[CURRENT-1]" = "-display" ]; then
+  compgen -k hosts -S':0'
+else
+  compadd -J options - -display -name -xrm
+fi