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

Re: PostgreSQL completion

Dominic Mitchell wrote:
> 1.  I use psql to get information from the database.  But what happens
> if psql spits out an error?  At the moment, it just messes up the
> display...

The usual method is simply to add 2>/dev/null to the command.  If you
want to be smarter about errors you need to work harder.

> 2.  How do you complete either a hostname or a path at the same point?
> PostgreSQL accepts either a hostname or a directory containing a socket
> after -h.

The easy way is _alternative, assuming you have functions for both
cases.  _ssh does (after a bit of editing):

  _alternative \
    'hosts:remote host name:_ssh_hosts' \
    'users:login name:_ssh_users -qS@'

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.


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