zsh-workers
 help / color / mirror / code / Atom feed
From: dana <dana@dana.is>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: [PATCH] _find: Fix return value
Date: Thu, 15 Aug 2019 15:56:23 -0500	[thread overview]
Message-ID: <4A0FB427-B054-4EE2-99F4-558B41114A4E@dana.is> (raw)

I noticed that _find wasn't respecting my matcher styles (e.g., `find /a<TAB>`
wouldn't match /Applications), and it looks like it's because it erroneously
returns with 1 most of the time

dana


diff --git a/Completion/Unix/Command/_find b/Completion/Unix/Command/_find
index edd46ac1c..3b9150b17 100644
--- a/Completion/Unix/Command/_find
+++ b/Completion/Unix/Command/_find
@@ -1,6 +1,6 @@
 #compdef find gfind
 
-local curcontext="$curcontext" state_descr variant default
+local curcontext="$curcontext" state_descr variant default ret=1
 local -a state line args alts disp smatch
 
 _pick_variant -r variant gnu=GNU $OSTYPE -version
@@ -147,7 +147,8 @@ _arguments -C $args \
   '*-user:user:_users' \
   '*-xdev' \
   '*-a' '*-o' \
-  '(-D -E -H -L -O -P -f -s -x --help --version)*:directory:_files -/'
+  '(-D -E -H -L -O -P -f -s -x --help --version)*:directory:_files -/' \
+&& ret=0
 
 if [[ $state = times ]]; then
   if ! compset -P '[+-]' || [[ -prefix '[0-9]' ]]; then
@@ -164,5 +165,7 @@ if [[ $state = times ]]; then
     alts=( "senses:sense${default}:compadd -V times -S '' -d disp -a smatch" )
   fi
   alts+=( "times:${state_descr}:_dates -f d" )
-  _alternative $alts
+  _alternative $alts && ret=0
 fi
+
+return ret


                 reply	other threads:[~2019-08-16  1:12 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=4A0FB427-B054-4EE2-99F4-558B41114A4E@dana.is \
    --to=dana@dana.is \
    --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).