Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Completion error message



On Thu, Jan 25, 2018 at 11:21 PM, Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> On Thu, Jan 25, 2018 at 9:24 PM, Oliver Kiddle <okiddle@xxxxxxxxxxx> wrote:
>> Daniel Shahaf wrote:
>>> «rsync -4 -6 --<TAB>» does nothing and prints nothing.
>>
>> The inactive option (-6) is seen as an invalid argument when parsing for
>> each of the two sets. Both sets get disabled and there's no completion.
>> As I mentioned in 40129, we could do something with marking sets for
>> fallback and examine them twice.
>>
>> I'm not especially keen on producing error messages from completion.
>
> For most other commands you get
> % zsh --aoentuh<tab>
> ---- no match for: `script file', `directory', or `option'
>
> And it's also sort of surprising that _complete_help does nothing at all.

You only get the "no match for: ..." text if you have set the
appropriate zstyle.

However, the lack of both help and description is directly connected
to what Oliver was explaining.  Because all possible sets of
completions are excluded, _arguments never calls _description and
there is nothing for _main_complete to report as the context.

How about this?

BartMAC2014% zstyle ':completion:*:messages' format %S%d%s
BartMAC2014% rsync -4 -6 --
no valid completions

It may have other unintended side-effects, though.

diff --git a/Completion/Base/Utility/_arguments
b/Completion/Base/Utility/_arguments
index 136dd58..7b2bd40 100644
--- a/Completion/Base/Utility/_arguments
+++ b/Completion/Base/Utility/_arguments
@@ -583,5 +583,6 @@ if (( $# )) && comparguments -i "$autod"
"$singopt[@]" "$@"; then

   [[ nm -ne "$compstate[nmatches]" ]]
 else
+  _message "no valid completions"
   return 1
 fi



Messages sorted by: Reverse Date, Date, Thread, Author