zsh-workers
 help / color / mirror / code / Atom feed
From: "Jun T." <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Subject: [PATCH] _grep: support bzgrep (and add a few options for darwin)
Date: Mon, 16 Jul 2018 23:01:49 +0900	[thread overview]
Message-ID: <BFAC5FBA-B720-408F-A638-18DC3B77EEF8@kba.biglobe.ne.jp> (raw)

Add support for bzgrep.
Also add a few options specific to darwin.


diff --git a/Completion/Unix/Command/_grep b/Completion/Unix/Command/_grep
index 5f45ce9a8..3bc8d3fe0 100644
--- a/Completion/Unix/Command/_grep
+++ b/Completion/Unix/Command/_grep
@@ -1,4 +1,4 @@
-#compdef grep egrep fgrep bsdgrep zgrep zegrep zfgrep ggrep gegrep gfgrep gzgrep gzegrep gzfgrep -value-,GREP_OPTIONS,-default-
+#compdef grep egrep fgrep bsdgrep zgrep zegrep zfgrep ggrep gegrep gfgrep gzgrep gzegrep gzfgrep bzgrep bzegrep bzfgrep -value-,GREP_OPTIONS,-default-
 
 local arguments matchers command variant
 
@@ -11,13 +11,15 @@ else
   arguments=( '(-e --regexp -f --file)1: :_guard "^-*" pattern' )
   if [[ $service = z* ]]; then
     arguments+=( '*:files:_files -g "*.gz(-.)"' )
+  elif [[ $service = bz* ]]; then
+    arguments+=( '*:files:_files -g "*.bz2(-.)"' )
   else
     arguments+=( '*:files:_files' )
   fi
   command="$words[1]"
 fi
 
-if [[ $service != (|g)(|z)[ef]grep ]]; then
+if [[ $service != (|g|z|gz|bz)[ef]grep ]]; then
   matchers='(--extended-regexp --fixed-strings --basic-regexp --perl-regexp -E -F -G -P)'
   arguments+=(
     $matchers{--extended-regexp,-E}'[use extended regular expression]'
@@ -66,7 +68,7 @@ arguments+=(
 _pick_variant -r variant -c "$command" gnu=gnu gpl2=2.5.1 unix --version
 case $variant:$OSTYPE in
   (gnu:*|gpl2:freebsd*))
-    [[ $service != (|g)(|z)[ef]grep ]] && arguments+=(
+    [[ $service != (|g|z|gz|bz)[ef]grep ]] && arguments+=(
       $matchers{--perl-regexp,-P}'[use perl regular expression]'
     )
   ;|
@@ -76,15 +78,19 @@ case $variant:$OSTYPE in
       '(-z --null-data)'{-z,--null-data}'[input data separated by 0 byte, not newline]'
     )
   ;|
-  gpl2:freebsd*)
+  gpl2:(freebsd|darwin)*)
     arguments+=(
       '(--null --no-filename -h)--null[print 0 byte after each filename]'
+      '(-Z --decompress -J --bz2decompress)'{-J,--bz2decompress}"[decompress bzip2'ed input before searching]"
+      '(-Z --decompress -J --bz2decompress)'{-Z,--decompress}"[decompress gzip'ed input before searching]"
     )
   ;|
-  gpl2:(freebsd|darwin)*)
+  gpl2:darwin*)
     arguments+=(
-      '(-Z --decompress -J --bz2decompress)'{-J,--bz2decompress}"[decompress bzip2'ed input before searching]"
-      '(-Z --decompress -J --bz2decompress)'{-Z,--decompress}"[decompress gzip'ed input before searching]"
+      '(-p -S)-O[follow symlinks on the command line]'
+      '(-O -S)-p[do not follow symlinks]'
+      '(-O -p)-S[follow all symlinks]'
+      '*--include-dir=[only search directories matching specified pattern]:directory pattern'
     )
   ;|
   (gnu:*|gpl2:netbsd*))




                 reply	other threads:[~2018-07-16 14:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BFAC5FBA-B720-408F-A638-18DC3B77EEF8@kba.biglobe.ne.jp \
    --to=takimoto-j@kba.biglobe.ne.jp \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).