From 825c3b31d2a9dad8d3438d2f25d1d1909a32af30 Mon Sep 17 00:00:00 2001 From: Julien Nicoulaud Date: Sun, 31 Jul 2011 19:32:00 +0200 Subject: [PATCH] Ack: add --type/--notype options --- _ack | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/_ack b/_ack index 2edba92..a7aa02b 100644 --- a/_ack +++ b/_ack @@ -43,9 +43,12 @@ _ack() { - local curcontext="$curcontext" state line cmds ret=1 + local curcontext="$curcontext" state line cmds type_opts ret=1 + + # FIXME Somehow duplicates _ack_types + type_opts=(${${(S)${(f)${${"$(_call_program types $words[1] --help=types)"}#*--\[no\]}}#*no\]}/ ##/\[}"]") + type_opts=("--"$type_opts "--no"$type_opts) - # FIXME Add directly --type/--notype _arguments -C \ '(- 1 *)--version[Display version and copyright information.]' \ '(- 1 *)--help[Print a short help statement.]' \ @@ -101,6 +104,7 @@ _ack() { '(-v --invert-match)'{-v,--invert-match}'[Invert match: select non-matching lines.]' \ '(-w --word-regexp)'{-w,--word-regexp}'[Force PATTERN to match only whole words.]' \ '(-1)-1[Stops after reporting first match of any kind.]' \ + "$type_opts[@]" \ '1: :->patterns' \ '*: :_files' \ && ret=0