zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Zsh workers <zsh-workers@zsh.org>
Subject: PATCH: fix completion for ack 3beta
Date: Thu, 01 Nov 2018 13:41:07 +0100	[thread overview]
Message-ID: <80802-1541076067.254546@VRCM.-1Xu.KgLD> (raw)

The ack completion fails with ack 2.999 because the output from the
--help-types option has very subtly changed (first becomes First).

Also the ${+commands[${words[1]}]} test is not helpful because that
will always return 0 for full paths - I was trying it with "./ack"
having downloaded the standalone Perl script.

And while I was looking at it, I've updated the options.

Oliver

diff --git a/Completion/Unix/Command/_ack b/Completion/Unix/Command/_ack
index 626e54e0f..e83a9330e 100644
--- a/Completion/Unix/Command/_ack
+++ b/Completion/Unix/Command/_ack
@@ -21,17 +21,18 @@ zstyle -s ":completion:${curcontext}:" cache-policy update_policy
 
 typeset -ga _ack_raw_types
 if _cache_invalid ack-types || ! _retrieve_cache ack-types; then
-  (( ${+commands[${words[1]}]} )) && _ack_raw_types=(
-      ${(S)${(S)${(f)${${"$(_call_program file-types $words[1] --help=types)"}#*--\[no\]}}%; first line matches \/*\/}#*no\]} )
+  _ack_raw_types=(
+      ${(S)${(S)${(f)${${"$(_call_program file-types $words[1] --help-types)"}#*--\[no\]}}%; ?irst line matches \/*\/}#*no\]} )
   [[ $#_ack_raw_types -gt 0 ]] && _store_cache ack-types _ack_raw_types
 fi
 
 (( $#words > 2 )) && ign='!'
 
 _arguments -C -s -S \
-  '(-i --ignore-case --smart-case --no-smart-case --nosmart-case --lines)'{-i,--ignore-case}'[match case-insensitively]' \
-  '(-i --ignore-case --no-smart-case --nosmart-case --lines)--smart-case[case-insensitive match unless pattern includes uppercase]' \
-  '(-i --ignore-case --smart-case --no-smart-case --nosmart-case --lines)'{--no-smart-case,--nosmart-case}'[disable --smart-case option]' \
+  '(-i --ignore-case -I -S --smart-case --no-smart-case --nosmart-case --lines)'{-i,--ignore-case}'[match case-insensitively]' \
+  '(-i --ignore-case -I -S --no-smart-case --nosmart-case --lines)'{-S,--smart-case}'[case-insensitive match unless pattern includes uppercase]' \
+  '(-i --ignore-case -I -S --smart-case --no-smart-case --nosmart-case --lines)'{--no-smart-case,--nosmart-case}'[disable --smart-case option]' \
+  '(-i --ignore-case -S --smart-case --no-smart-case --nosmart-case --lines)-I[turn on case-sensitivity in pattern]' \
   '(-v --invert-match)'{-v,--invert-match}'[select non-matching lines]' \
   '(-w --word-regexp)'{-w,--word-regexp}'[force pattern to match only whole words]' \
   '(-Q --literal)'{-Q,--literal}'[use literal strings]' \
@@ -59,10 +60,12 @@ _arguments -C -s -S \
   '(--nobreak --break)'{--nobreak,--break}'[print a break between results from different files, default on]' \
   '(--nogroup)--group[group matches by file name]' \
   "(--group)--nogroup[don't group matches by file name]" \
+  '--proximate=[separate match output with blank lines unless they are adjacent]::proximity (lines)' \
   '(--nocolor --nocolour)--colo'{,u}'r[enable color highlighting of output]' \
-  '(--color --colour --color-filename --color-match --color-lineno)--nocolo'{,u}'r[suppress the color]' \
+  '(--color --colour --color-filename --color-match --color-colno --color-lineno)--nocolo'{,u}'r[suppress the color]' \
   '(--nocolor --nocolour --color --colour)--color-filename=[sets the color to be used for filenames]:color:->colors' \
   '(--nocolor --nocolour --color --colour)--color-match=[sets the color to be used for matches]:color:->colors' \
+  '(--nocolor --nocolour --color --colour)--color-colno=[specify color for column numbers]:color:->colors' \
   '(--nocolor --nocolour --color --colour)--color-lineno=[specify color for line numbers]:color:->colors' \
   '--flush[flush output on every line]' \
   '(1)-f[only print the files that would be searched, without actually doing any searching]' \
@@ -92,6 +95,8 @@ _arguments -C -s -S \
   '(--filter --nofilter)--filter[treat standard input as pipe]' \
   '(--filter --nofilter)--nofilter[treat standard input as tty]' \
   "${ign}(- 1 *)--man[display the manual page]" \
+  "${ign}(- 1 *)--faq[display the frequently asked questions]" \
+  "${ign}(- 1 *)--cookbook[display a list of tips and tricks for using ack]" \
   "${ign}(- 1 *)--version[display version and copyright information]" \
   "${ign}(- 1 *)--bar[consult Admiral Ackbar]" \
   "${ign}(- 1 *)--thpppt[bill the cat]" \

             reply	other threads:[~2018-11-01 12:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-01 12:41 Oliver Kiddle [this message]
2018-11-01 22:29 ` Joey Pabalinas

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=80802-1541076067.254546@VRCM.-1Xu.KgLD \
    --to=okiddle@yahoo.co.uk \
    --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).