Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

short option and long option completion formatting



Hello folks,

I'm writing completion functions and I've come across a formatting issue.

The commands I'm doing completions for have a number of short options and matching long options (such as -p and --port). The way I'm doing it now, using _arguments, is to have a seperate spec for the short options and the corresponding long options. These specs are, of course, virtually identical and when _arguments formats the output on screen they show up on seperate lines, such as:

--bar -- Description of bar
--baz -- Description of baz
--foo -- Description of foo
-a    -- Description of A
-b    -- Description of bar
-f    -- Description of foo

I want a way to combine these specs so as not to duplicate "code" and a way to format this all on one line, such as:

-a        -- A description
-b, --bar -- Description of bar
-f, --foo -- Description of foo
     --baz -- baz description

I find this formatting quite a bit more readable especially as the number of options increases. I've done some searching on the ML archives and poking around the official completion functions and havn't found anything related. I'm really new to writing completions and looking for help.

Any ideas on how to implement this?

Thank you,
-Eric Mangold

-PS By the way, the commands I'm doing completion for are twistd and mktap of the Twisted project. use their --help options to see how that gets formatted (very close to what I want the completion to look like). Or if anyone is curious about how it looks and doesn't want to install Twisted I shall respond with that info.



Messages sorted by: Reverse Date, Date, Thread, Author