From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3183 invoked by alias); 24 Jul 2013 17:17:54 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 31576 Received: (qmail 22829 invoked from network); 24 Jul 2013 17:17:38 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at spf01.biglobe.ne.jp designates 133.205.19.70 as permitted sender) X-Biglobe-Sender: From: "Jun T." Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: [PATCH] _make: Better option handling of GNU make Message-Id: <67559267-3FF6-4681-A6F4-7B984C9ABA8A@kba.biglobe.ne.jp> Date: Thu, 25 Jul 2013 01:14:22 +0900 To: "zsh-workers@zsh.org" Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) X-Mailer: Apple Mail (2.1508) Take care of mutually exclusive options. Add _description using $state_descr. Add completions for --debug=3Dflag. Fix typo (pointed out by Daniel Shahaf). --- Completion/Unix/Command/_make | 76 = ++++++++++++++++++++++++----------------- 1 file changed, 44 insertions(+), 32 deletions(-) diff --git a/Completion/Unix/Command/_make = b/Completion/Unix/Command/_make index 355c68e..0c5371d 100644 --- a/Completion/Unix/Command/_make +++ b/Completion/Unix/Command/_make @@ -148,7 +148,7 @@ _make-findBasedir () { _make() { =20 local prev=3D"$words[CURRENT-1]" file expl tmp is_gnu dir incl match - local context state line + local context state state_descr line local -a option_specs local -A TARGETS VARIABLES opt_args local ret=3D1 @@ -159,35 +159,35 @@ _make() { then incl=3D"(-|)include" option_specs=3D( - {-B,--always-make}'[Unconditionally make all targets]' - '*'{-C,--directory=3D}'[change directory first]:directory:->dir' - '-d[Print lots of debug information]' - '--debug=3D-[Print various types of debug information]:FLAGS' - {-e,--environment-overrides}'[Environment variables override = makefiles]' - '--eval=3D-[Evaluate STRING as a makefile statement]:STRING' - {-f,--file=3D,--makefile=3D}'[Read FILE as a = makefile]:file:->file' - '-h[Print this message and exit]' - {-i,--ignore-errors}'[Ignore errors from recipes]' - '*'{-I,--include-dir=3D}'[Search DIRECTORY for included = makefiles]:directory:->dir' - {-j,--jobs=3D}'[Allow N jobs at once; infinite jobs with no = arg]:number of jobs' - {-k,--keep-going}"[Keep going when some targets can't be made]" - {-l,--load-average=3D,--max-load}"[Don't start multiple jobs = unless load is below N]:load" - {-L,--check-symlink-times}'[Use the latest mtime between symlinks = and target]' - {-n,--just-print,--dry-run,--recon}"[Don't actually run any = recipe; just print them]" - '*'{-o,--old-file=3D,--assume-old=3D}"[Consider FILE to be very = old and don't remake it]:file not to remake:->file" - {-p,--print-data-base}'[Print makes internal database]' - {-q,--question}'[Run no recipe; exit status says if up to date]' - {-r,--no-builtin-rules}'[Disable the built-in implicit rules]' - {-R,--no-builtin-variables}'[Disable the built-in variable = settings]' - {-s,--silent,--quiet}"[Don't echo recipes]" - {-S,--no-keep-going,--stop}'[Turns off -k]' - {-t,--touch}'[Touch targets instead of remaking them]' - {-v,--version}'[Print the version number of make and exit]' - {-w,--print-directory}'[Print the current directory]' - '--no-print-directory[Turn off -w, even if it was turned on = implicitly]' - '*'{-W,--what-if=3D,--new-file=3D,--asume-new=3D}'[Consider FILE = to be infinitely new]:file to treat as modified:->file' - '--warn-undefined-variables[Warn when an undefined variable is = referenced]' - '--warn-undefined-functions[Warn when an undefined user function = is called]' + '(-B --always-make)'{-B,--always-make}'[unconditionally make all = targets]' + '*'{-C,--directory=3D}'[change directory first]:change to = directory:->dir' + '-d[print lots of debug information]' + '--debug=3D-[print various types of debug information]:debug = options:->debug' + '(-e = --environment-overrides)'{-e,--environment-overrides}'[environment = variables override makefiles]' + '--eval=3D-[evaluate STRING as a makefile statement]:STRING' + '(-f --file --makefile)'{-f,--file=3D,--makefile=3D}'[read FILE = as a makefile]:makefile:->file' + '(- *)'{-h,--help}'[print help message and exit]' + '(-i --ignore-errors)'{-i,--ignore-errors}'[ignore errors from = recipes]' + '*'{-I,--include-dir=3D}'[search DIRECTORY for included = makefiles]:search path for included makefile:->dir' + '(-j --jobs)'{-j,--jobs=3D}'[allow N jobs at once; infinite jobs = with no arg]:number of jobs' + '(-k --keep-going)'{-k,--keep-going}"[keep going when some = targets can't be made]" + '(-l --load-average = --max-load)'{-l,--load-average=3D,--max-load}"[don't start multiple jobs = unless load is below N]:load" + '(-L --check-symlik-times)'{-L,--check-symlink-times}'[use the = latest mtime between symlinks and target]' + '(-n --just-print --dry-run = --recon)'{-n,--just-print,--dry-run,--recon}"[don't actually run any = recipe; just print them]" + '*'{-o,--old-file=3D,--assume-old=3D}"[consider FILE to be very = old and don't remake it]:file not to remake:->file" + '(-p --print-data-base)'{-p,--print-data-base}'[print makes = internal database]' + '(-q --question)'{-q,--question}'[run no recipe; exit status says = if up to date]' + '(-r --no-builtin-rules)'{-r,--no-builtin-rules}'[disable the = built-in implicit rules]' + '(-R --no-builtin-variables)'{-R,--no-builtin-variables}'[disable = the built-in variable settings]' + '(-s --silent --quiet)'{-s,--silent,--quiet}"[don't echo = recipes]" + '(-S --no-keep-going --stop)'{-S,--no-keep-going,--stop}'[turns = off -k]' + '(-t --touch)'{-t,--touch}'[touch targets instead of remaking = them]' + '(- *)'{-v,--version}'[print the version number of make and = exit]' + '(-w --print-directory)'{-w,--print-directory}'[print the current = directory]' + '--no-print-directory[turn off -w, even if it was turned on = implicitly]' + '*'{-W,--what-if=3D,--new-file=3D,--assume-new=3D}'[consider FILE = to be infinitely new]:file to treat as modified:->file' + '--warn-undefined-variables[warn when an undefined variable is = referenced]' + '--warn-undefined-functions[warn when an undefined user function = is called]' ) else # Basic make options only. @@ -206,11 +206,23 @@ _make() { =20 case $state in (dir) - _files -W ${(q)$(_make-findBasedir ${words[1,CURRENT-1]})} -/ && = ret=3D0 + _description directories expl "$state_descr" + _files "$expl[@]" -W ${(q)$(_make-findBasedir = ${words[1,CURRENT-1]})} -/ && ret=3D0 ;; =20 (file) - _files -W ${(q)$(_make-findBasedir $words)} && ret=3D0 + _description files expl "$state_descr" + _files "$expl[@]" -W ${(q)$(_make-findBasedir $words)} && ret=3D0 + ;; + + (debug) + _values -s , 'debug options' \ + '(b v i j m)a[all debugging output]' \ + 'b[basic debugging output]' \ + '(b)v[one level above basic]' \ + '(b)i[describe implicit rule searches (implies b)]' \ + 'j[show details on invocation of subcommands]' \ + 'm[enable debugging while remaking makefiles]' && ret=3D0 ;; =20 (target) --=20 1.7.9.6 (Apple Git-31.1)