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

Re: Refactoring _bsd_pkg

On 2 Jan, James Devenish wrote:

> Yes, that's fine, I have attached a diff for the beast, only improving


> pkd_delete, and pkg_info. I also replaced tabs with spaces since the
> file seemed to have a mixture, and that's made the patch a bit large.
> This is just a heads-up and I don't really intent on anyone feeling
> willing to commit this verbatim -- it's night-time here and I'll have

I've had a cursory glance through it and it all looks fine to me. Can
$(arch -s) be safely replaced by $MACHTYPE?

When you've got it to a point you're happy with, let me know and it can
then be committed.

> another look at it tomorrow. (And the person with the CC of my post is
> the OpenBSD port maintainer for zsh, so he may have something useful to
> add.)

Except I got a delivery failure for him so he may not see the whole
> pkg_add still doesn't work quite right because it always has some
> directories (those matching the pattern /*) in the completion list,
> even if my current directory is not /.

This is in _bsd_pkg_pkgfiles() right?

This bit looks suspicious:

  paths=( "${(@)${(@s.:.)PKG_PATH}:#}" )
  _files "$@" -g '*.t[bg]z' && ret=0
  (( $#path )) && _files "$@" -W paths -g '*.t[bg]z' && ret=0
  compadd "$@" - $pkgsdir/*.t[bg]z && ret=0

The paths= line results in $paths containing a single empty element if
PKG_PATH is not set. Does PKG_PATH have a default value?
And shouldn't 
  (( $#path )) &&
  (( $#paths )) &&

Can you do the whole thing as one _files line, something like this:

paths=( . $pkgsdir ${(s.:.)PKG_PATH} )
_files "$@" -W paths -g '*.t[bg]z'

> PS. I replaced '\'' with '', but maybe that's not portable? Also, I

That depends on the rcquotes option. You can only depend on those options
listed in $_comp_options (of which rcquotes is not one). I tend to stick
the whole line in double quotes to make it more readable.


This e-mail and any attachment is for authorised use by the intended recipient(s) only.  It may contain proprietary material, confidential information and/or be subject to legal privilege.  It should not be copied, disclosed to, retained or used by, any other party.  If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender.  Thank you.

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