From: Haakon Riiser <haakon.riiser@fys.uio.no>
To: <zsh-workers@zsh.org>
Subject: Re: How to do completion of toggle flag sequences separated by +/-
Date: Mon, 02 May 2011 11:16:06 +0200 [thread overview]
Message-ID: <d1c7fa74d76af9e829df17e7ed59a6da@ulrik.uio.no> (raw)
In-Reply-To: <20110501171846.7ea9607f@pws-pc.ntlworld.com>
On Sun, 1 May 2011 17:18:46 +0100, Peter Stephenson
<p.w.stephenson@ntlworld.com> wrote:
> On Sun, 01 May 2011 12:16:05 +0200
> Haakon Riiser <haakon.riiser@fys.uio.no> wrote:
>> I'm still working on perfecting the FFmpeg completion function, and
>> one
>> of the most important things missing is good completion of toggle
>> flags.
>>
>> Here's an example of FFmpeg's toggle flag syntax:
>>
>> ffmpeg -flags +gmc-global_header+cgop
>> [...]
>
> I don't think there's a prepackaged way of doing this. I've had some
> luck with the following. One thing it doesn't do is treat the + and
> -
> as separate from the options following, but a bit of patience might
> sort
> that out.
>
> It's actually written to complete options for the fictitious "flags"
> command, so you also have to insinuate it into ffmpeg completion
> somehow.
> [...]
Thanks, that's an excellent starting point. I will try to integrate
this into _ffmpeg shortly.
By the way: When defining sub-functions inside a completion function,
is it recommended to test for their existence before defining them?
E.g.,
(( $+functions[_ffmpeg_foo] )) || _ffmpeg_foo() {
...
}
I see this in a lot of completers included with zsh, and I assumed it
was done for performance reasons (although it seems strange that the
performance hit could be significant, considering that the code is only
executed once per TAB keypress).
--
Haakon
next prev parent reply other threads:[~2011-05-02 9:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-01 10:16 Haakon Riiser
2011-05-01 16:18 ` Peter Stephenson
2011-05-02 9:16 ` Haakon Riiser [this message]
2011-05-03 10:27 ` Peter Stephenson
2011-05-03 13:49 ` Haakon Riiser
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=d1c7fa74d76af9e829df17e7ed59a6da@ulrik.uio.no \
--to=haakon.riiser@fys.uio.no \
--cc=zsh-workers@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).