about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2001-08-06 15:48:53 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2001-08-06 15:48:53 +0000
commitab483ef55e06fdfe2091615979469bb9738970df (patch)
tree5577065417483cf81dc01e3521fa90f4010cf583
parent9147854368c7a0e9afad61187598b66ad0f5dbd6 (diff)
downloadzsh-ab483ef55e06fdfe2091615979469bb9738970df.tar.gz
zsh-ab483ef55e06fdfe2091615979469bb9738970df.tar.xz
zsh-ab483ef55e06fdfe2091615979469bb9738970df.zip
fix exclusion lists (15577)
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Command/_grep71
-rw-r--r--Completion/Unix/Command/_loadkeys25
3 files changed, 101 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 1421db44e..a17938d7c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-08-06  Oliver Kiddle  <opk@zsh.org>
+
+	* 15577: Completion/Unix/Command/_grep,
+	Completion/Unix/Command/_loadkeys: fix exclusion lists
+
 2001-07-31  Clint Adams  <clint@zsh.org>
 
         * 15551: Completion/Unix/Command/_gzip: handle -l and -t
diff --git a/Completion/Unix/Command/_grep b/Completion/Unix/Command/_grep
new file mode 100644
index 000000000..d9dcad0af
--- /dev/null
+++ b/Completion/Unix/Command/_grep
@@ -0,0 +1,71 @@
+#compdef grep egrep fgrep
+# Ulrik Haugen 2001
+
+local efgrep="" efarguments arguments
+
+(( $+_is_gnu )) || typeset -gA _is_gnu
+
+if (( ! $+_is_gnu[$words[1]] )); then
+  if [[ $(_call_program version $words[1] --help </dev/null 2>/dev/null) = *gnu* ]]
+  then
+    _is_gnu[$words[1]]=yes
+  else
+    _is_gnu[$words[1]]=
+  fi
+fi
+
+
+[[ "$service" = [ef]grep ]] && efgrep=t
+
+if [[ -z $efgrep ]]; then
+  efarguments=( \
+    '(--extended-regexp -F --fixed-strings)-E[extended regexp]' \
+    '(-E -F --fixed-strings)--extended-regexp' \
+    '(--fixed-strings -E --extended-regexp)-F[fixed strings]' \
+    '(-F -E --extended-regexp)--fixed-strings' \
+  )
+fi
+
+arguments=( \
+  '(-e --regexp -f --file)1:pattern:_guard "^--*"' \
+  '(1)*'{'-e+[regexp]',--regexp=}':pattern' \
+  '(1)*'{'-f+[file]',--file=}':pattern file:_files' \
+  \
+  '*:files:_files' \
+  \
+  {'(--after-context)-A+[after context]','(-A)--after-context='}':after context:(1)' \
+  '(--text --binary-files)-a[text]' '(-a --binary-files)--text' \
+  {'(--before-context)-B+[before context]','(-B)--before-context='}':before context:(1)' \
+  {'(--context)-C+[context]','(-C)--context='}':context:(1)' \
+  '(--byte-offset)-b[byte offset]' '(-b)--byte-offset' \
+  '(-a --text -I)--binary-files:binary files:(binary without-match text)' \
+  '(--count)-c[count]' '(-c)--count' \
+  {'(--directories -r --recursive)-d+[directories]','(-d -r --recursive)--directories='}':directories:(read skip recurse grep)' \
+  \
+  $efarguments \
+  \
+  '(--basic-regexp)-G[basic regexp]' '(-G)--basic-regexp' \
+  '(--with-filename)-H[with filename]' '(-H)--with-filename' \
+  '(--no-filename)-h[no filename]' '(-h)--no-filename' \
+  '--help' \
+  '(--binary-files)-I[ignore binary]' \
+  '(--ignore-case)-i[ignore case]' '(-i)--ignore-case' \
+  '(--files-without-match)-L[files without match]' '(-L)--files-without-match' \
+  '(--files-with-matches -l)'{'-l[files with matches]',--files-with-matches} \
+  '--mmap' \
+  '(--line-number)-n[line number]' '(-n)--line-number' \
+  '(--quiet --silent)-q[quiet]' '(-q --quiet)--silent' '(-q --silent)--quiet' \
+  '(--recursive -d --directories)-r[recursive]' '(-r -d --directories)--recursive' \
+  '(--no-mesages)-s[no messages]' '(-s)--no-messages' \
+  '(--version)-V[version]' '(-V)--version' \
+  '(--invert-match)-v[invert match]' '(-v)--invert-match' \
+  '(--word-regexp)-w[word regexp]' '(-w)--word-regexp' \
+  '(--line-regexp)-x[line regexp]' '(-x)--line-regexp' \
+  '(--null)-Z[null]' '(-Z)--null' \
+)
+
+# remove long options?
+[[ -z "$_is_gnu[$words[1]]" ]] &&
+    arguments=( ${arguments:#(|*\)(\*|))--*} )
+
+_arguments -s $arguments
diff --git a/Completion/Unix/Command/_loadkeys b/Completion/Unix/Command/_loadkeys
new file mode 100644
index 000000000..da3a19df7
--- /dev/null
+++ b/Completion/Unix/Command/_loadkeys
@@ -0,0 +1,25 @@
+#compdef loadkeys
+
+case $OSTYPE in
+  linux*)
+    _arguments \
+	'(--clearcompose)-c[clearcompose]' \
+	'(-c)--clearcompose' \
+	'(--default)-d[default]' \
+	'(-d)--default' \
+	'(--help)-h[help]' \
+	'(-h)--help' \
+	'(--mktable)-m[mktable]' \
+	'(-m)--mktable' \
+	'(--clearstrings)-s[clearstrings]' \
+	'(-s)--clearstrings' \
+	'*-v[verbose]' \
+	'*--verbose' \
+	':keymap:_files -W /usr/share/keymaps'
+  ;;
+  solaris*)
+	_files -W /usr/share/lib/keytables
+  ;;
+
+  *) _default;;
+esac