zsh-workers
 help / color / mirror / code / Atom feed
* How to do completion of toggle flag sequences separated by +/-
@ 2011-05-01 10:16 Haakon Riiser
  2011-05-01 16:18 ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: Haakon Riiser @ 2011-05-01 10:16 UTC (permalink / raw)
  To: zsh-workers

 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

 In the above example, three toggle flags are set:

 gmc is enabled (+)
 global_header is disabled (-)
 cgop is enabled (+)

 Ideally, I would like the completion to behave like this:

 ffmpeg -flags ^I

 Typing the above should generate two matches: "+" and "-". Next,

 ffmpeg -flags +^I

 should generate a list of all possible flag values (gmc, cgop, etc). 
 Next, select one of the flags, e.g.:

 ffmpeg -flags +gmc^I

 An important point here is that *no space should be inserted* after the 
 inserted flag; the cursor must be placed immediately after "+gmc". 
 Pressing TAB again should repeat the process by again suggesting "+" or 
 "-" to add more flags. Once I'm done adding flags, I type in a space and 
 completion should no longer be in toggle flag mode.

 Achieving this seems very hard to do, because there could be ambiguity 
 in some cases. Assume that "foo" and "foobar" are both valid flags, and 
 I type this:

 ffmpeg -flags +foo^I

 Here, there are two possibilities: Either suggest "+" or "-" as if a 
 new flag is to be completed (because +foo is a valid flag), or complete 
 to +foobar because there is also a flag by that name. Resolving this is 
 probably complicated, so I'll probably compromise on something. Does 
 anyone have any suggestions on how to get as close to the above ideal 
 completion behavior using standard zsh completion functions (_values, 
 _arguments, etc)?

-- 
  Haakon


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-05-03 13:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-01 10:16 How to do completion of toggle flag sequences separated by +/- Haakon Riiser
2011-05-01 16:18 ` Peter Stephenson
2011-05-02  9:16   ` Haakon Riiser
2011-05-03 10:27     ` Peter Stephenson
2011-05-03 13:49       ` Haakon Riiser

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).