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

Re: rsync --progress stops completion



On Sep 18, 11:42am, Yuri D'Elia wrote:
} Subject: Re: rsync --progress stops completion
}
} On 09/17/2014 05:51 PM, Bart Schaefer wrote:
} > Sure, just add _files to the end of your completer zstyle, e.g.:
} > 
} > zstyle ':completion:*' completer _oldlist _expand _complete _files 
} 
} That would be the heavy handed approach, however I think it would be a
} better approach (in general) to ignore unknown command-line arguments

Two points:

 - this doesn't help in the example in question because the command-line
   argument isn't unknown; it's both known and specifically excluded.

 - I don't follow how this is "heavy handed"; when the context parse
   goes wrong (or intentionally fails), the completion has to fall back
   on *something*.  What would you like that something to be, and how
   would you like to tell the completion system about it, if not in the
   completer zstyle?

} Some sort of visual clue that the completion stopped because of an error
} could also be helpful maybe?

This might help:

_oopsie() { _message "No completions" }
zstyle ':completion:*:messages' format %S%d%s
zstyle ':completion:*' completer _oldlist _expand _complete _oopsie

We could also consider this (I'm not sure what unexpected side-effects
there might be, particularly for completers that try multiple calls
to _arguments):

diff --git a/Completion/Base/Utility/_arguments b/Completion/Base/Utility/_arguments
index d70c442..e9586e6 100644
--- a/Completion/Base/Utility/_arguments
+++ b/Completion/Base/Utility/_arguments
@@ -570,5 +570,6 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
 
   [[ nm -ne "$compstate[nmatches]" ]]
 else
+  _message "$service cannot parse command line"
   return 1
 fi



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