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

Re: Quoting problems with _zip (unzip) completer



Mikael Magnusson wrote:
> % unzip test\[.zip <tab>
> _zip:117: bad pattern: test[.zip(|.zip|.ZIP)
> _zip:117: bad pattern: test[.zip(|.zip|.ZIP)
> _zip:117: bad pattern: test[.zip(|.zip|.ZIP)
> 
>..
> @@ -114,7 +114,7 @@ case $state in
>      if [[ $service = zip ]] && (( ! ${+opt_args[-d]} )); then
>        _wanted files expl zfile _files -g
> '^(#i)*.(zip|xpi|[ejw]ar)(-.)' && return
>      else
> -      zipfile=( $~line[1](|.zip|.ZIP) )
> +      zipfile=( $line[1](|.zip|.ZIP) )
>        [[ -z $zipfile[1] ]] && return 1
>        if [[ $zipfile[1] !=  $_zip_cache_list ]]; then
>  	_zip_cache_name="$zipfile[1]"

The trouble is this stops you using filenames with a ~, among other
things.  This suggests the value of "line" is a bit inconsistent.  Sure
enough if I use ~/tmp/zip/tmp\[.zip $line[1] comes back (using print -r) as

  ~/tmp/zip/test[.zip

which is wrong---either the ~ needs to be expanded, or the [ needs to be
quoted.  So this needs tracking internally, unfortunately.  If it hits
the internal completion quoting system we're probably stuck---I spent
weeks looking at that a couple of years ago and got virtually nowhere.
However, it may not be that bad in this case.

-- 
Peter Stephenson <pws@xxxxxxx>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


'member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom'



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