zsh-users
 help / color / mirror / code / Atom feed
* short option and long option completion formatting
@ 2004-02-12  5:58 Eric Mangold
  2004-02-12 17:46 ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Mangold @ 2004-02-12  5:58 UTC (permalink / raw)
  To: zsh-users

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.


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

* Re: short option and long option completion formatting
  2004-02-12  5:58 short option and long option completion formatting Eric Mangold
@ 2004-02-12 17:46 ` Bart Schaefer
  0 siblings, 0 replies; 5+ messages in thread
From: Bart Schaefer @ 2004-02-12 17:46 UTC (permalink / raw)
  To: zsh-users

On Feb 11, 10:58pm, Eric Mangold wrote:
}
} 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

This is done automatically for options with identical descriptions, as
of zsh 4.1.something (I forget exactly when).  E.g. note -H and -v in
the cvs completion below:

schaefer<501> cvs -
Completing option
--allow-root         -- allowable root for pserver                             
--help           -H  -- print help information                                 
--help-commands      -- command help                                           
--help-options       -- global options help                                    
--help-synonyms      -- command synonyms help                                  
--version        -v  -- print version and copyright information                
(more trimmed)

So I'd say you should leave your completion function as it is, and consider
upgrading your zsh installation if you're desperate to have this.


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

* Re: short option and long option completion formatting
  2004-02-12 22:17 Eric Mangold
@ 2004-02-13 23:51 ` Eric Mangold
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Mangold @ 2004-02-13 23:51 UTC (permalink / raw)
  To: zsh-users

> This is done automatically for options with identical descriptions, as
> of zsh 4.1.something (I forget exactly when).

Great! I will certainly upgrade from 4.0.7.

Thanks,
-Eric

P.S. Sorry for triple posting my question...*sigh*...long story.


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

* short option and long option completion formatting
@ 2004-02-12 22:17 Eric Mangold
  2004-02-13 23:51 ` Eric Mangold
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Mangold @ 2004-02-12 22:17 UTC (permalink / raw)
  To: zsh-users

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.


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

* short option and long option completion formatting
@ 2004-02-12 21:56 Eric Mangold
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Mangold @ 2004-02-12 21:56 UTC (permalink / raw)
  To: zsh-users

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.


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

end of thread, other threads:[~2004-02-14  0:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-12  5:58 short option and long option completion formatting Eric Mangold
2004-02-12 17:46 ` Bart Schaefer
2004-02-12 21:56 Eric Mangold
2004-02-12 22:17 Eric Mangold
2004-02-13 23:51 ` Eric Mangold

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