Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: fix completion for ack 3beta
- X-seq: zsh-workers 43748
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: PATCH: fix completion for ack 3beta
- Date: Thu, 01 Nov 2018 13:41:07 +0100
- Authentication-results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1541076671; bh=KZTTL1clyrd3oPPeUWU0abf7npZjtHxzCAzyZm5PH1w=; h=From:To:Subject:Date:From:Subject; b=oqKbglaYO6vywQBjwrP4/y2YCZHntS8CX2DywhyLdVrQQw9h1akv17Ejs827DU9AeO9pTS75k1ZakgChwwdmfWUfcdxM+lwepb4qHFoRe8N5YO5H7ZXcRYu7Jv6UFomLHXM+pGed0f+ZoAH0zfqfxuydX2R0UE9ALsIvbrzLJwtCJ5bda6fHQ6jVdMiAa6AJMhoIkPAypXSnepH5/07p7hJEq79MAQPeO1oLYupR2Jsqs/0dIyKWhWpkiUjnPqzc1yT7CiFL7UQLm5CDPOJhB1Y8kg5HDGr6o3VnRxnmqylM1oYf2ty7SgWteI/DEMNa4DEf7prH5V+e2RiwzHTiEQ==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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]" \
Messages sorted by:
Reverse Date,
Date,
Thread,
Author