zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: mysql completions
Date: Mon, 13 Mar 2000 11:29:28 +0100 (MET)	[thread overview]
Message-ID: <200003131029.LAA18257@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Adam Spiers's message of Sat, 11 Mar 2000 18:25:33 +0000


Adam Spiers wrote:

> This turned out to be a really good way of getting my head round
> recent changes to the completion system.  Comments on the style (and
> correctness, especially relating to tags) welcome ...

The tags stuff looks fine, as far as I can see.

> ...
> 
> +_mysql_databases () {
> +  local _mysql_user _mysql_port _mysql_host _mysql_params
> +  _mysql_get_identity
> +
> +  local _mysql_databases
> +  _mysql_databases=(
> +                    ${(f)~~"$( echo "show databases" |
> +                               mysql "$_mysql_params[@]" )"}
> +                   )
> +  shift _mysql_databases
> +
> +  compadd "$expl[@]" - $_mysql_databases
> +}

This works, because $expl is set in all callers, but I think it would
be nicer to make this explicit by using $@. _argument gives $expl as
the arguments anyway (the way _mysql_databases is called from it) and
for the call from _*_commands it could easily be added. Maybe that's
just personal taste.

> +_mysql_tables () {
> +  local _mysql_user _mysql_port _mysql_host _mysql_params
> +  _mysql_get_identity
> +
> +  local _mysql_tables
> +  _mysql_tables=(
> +                 ${(f)~~"$( echo "show tables" |
> +                              mysql "$_mysql_params[@]" $1 )"}
> +                )
> +  # remove header
> +  shift _mysql_tables
> +
> +  compadd "$expl[@]" - $_mysql_tables
> +}

Almost the same, I think it would be better to change the calls to use 
`{ _mysql_tables $line[1] $expl }'.

> ...
>
> +_mysql_utils "$@"

[[ -o kshautoload ]] || _mysql_utils "$@"

(I hate kshautoload, too ;-)

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


             reply	other threads:[~2000-03-13 10:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-13 10:29 Sven Wischnowsky [this message]
2000-07-31 22:14 ` missing -o kshautoload checks Adam Spiers
2000-08-01  7:12   ` Bart Schaefer
  -- strict thread matches above, loose matches on Subject: below --
2000-03-11 18:25 PATCH: mysql completions Adam Spiers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200003131029.LAA18257@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).