From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14188 invoked by alias); 2 May 2011 09:16:30 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 29126 Received: (qmail 681 invoked from network); 2 May 2011 09:16:13 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at fys.uio.no does not designate permitted sender hosts) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 02 May 2011 11:16:06 +0200 From: Haakon Riiser To: Subject: Re: How to do completion of toggle flag sequences separated by +/- In-Reply-To: <20110501171846.7ea9607f@pws-pc.ntlworld.com> References: <7965011ce0f14864142f9006d881bba9@ulrik.uio.no> <20110501171846.7ea9607f@pws-pc.ntlworld.com> Message-ID: X-Sender: haakon.riiser@fys.uio.no User-Agent: Roundcube Webmail/0.4.2 X-UiO-Ratelimit-Test: rcpts/h 1 msgs/h 1 sum rcpts/h 1 sum msgs/h 1 total rcpts 1176 max rcpts/h 16 ratelimit 0 X-UiO-Spam-info: not spam, SpamAssassin (score=-5.0, required=5.0, autolearn=disabled, T_RP_MATCHES_RCVD=-0.01,UIO_MAIL_IS_INTERNAL=-5, uiobl=NO, uiouri=NO) X-UiO-Scanned: 20A32A1768AF584740A53A65E55EEF2F9A802C90 X-UiO-SPAM-Test: remote_host: 129.240.4.214 spam_score: -49 maxlevel 80 minaction 2 bait 0 mail/h: 85 total 1362506 max/h 663 blacklist 0 greylist 0 ratelimit 0 On Sun, 1 May 2011 17:18:46 +0100, Peter Stephenson wrote: > On Sun, 01 May 2011 12:16:05 +0200 > Haakon Riiser 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