zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: custom script Bash completion
Date: Sun, 10 Nov 2013 10:24:58 -0800	[thread overview]
Message-ID: <131110102458.ZM21475@torch.brasslantern.com> (raw)
In-Reply-To: <CABb6=DWg_P+E+WvRzxZPnWDRN2jbL1Xh3P6tAMdHx+pmvCTdMA@mail.gmail.com>

On Nov 10, 11:14am, Thomas Ballinger wrote:
>
> I'd like to use bash completion in zsh for a script with
> 
> complete -C 'tu --get-bash-completion' tu
> 
> 'tu --get-bash-completion' is invoked by zsh completion, but the three
> arguments bash would pass to it aren't being passed.

I'm not absolutely sure if the following explains that, because none of
the bash man pages I can find describe what those three arguments are,
but:  The zsh bash completions are compatible with bash 2.05b and it is
possible that those three arguments were not passed by that version.

Volunteers to update Completion/bashcompinit?

> Is there another config option I need to know about, or is this behavior
> not implemented?

Based on a quick peek at "compgen" in bashcompinit and a couple of stabs
with "complete -C /bin/echo foo" in bash itself, Thomas is expecting the
external command defined with "complete -C" to receive the same three
arguments that are passed to a shell function with "complete -F".

So the workaround for this particular anomaly is to do

    tu_completer() {
      echo $(tu --get-bash-completion "$@")
    }
    complete -F tu_completer tu


  reply	other threads:[~2013-11-10 18:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-10 16:14 Thomas Ballinger
2013-11-10 18:24 ` Bart Schaefer [this message]
2013-11-10 19:09   ` Thomas Ballinger
2013-11-10 20:25     ` Bart Schaefer
2013-11-10 21:34       ` Thomas Ballinger
2013-11-10 23:18   ` Chet Ramey
2013-11-11  2:12     ` Bart Schaefer

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=131110102458.ZM21475@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /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).