zsh-users
 help / color / mirror / code / Atom feed
* filename completions with prefixes
@ 2005-01-17  6:23 Wataru Kagawa
  2005-01-17 15:09 ` William Scott
  0 siblings, 1 reply; 2+ messages in thread
From: Wataru Kagawa @ 2005-01-17  6:23 UTC (permalink / raw)
  To: zsh-users

I am trying to write a completion function for a command called pdbset 
in which *.pdb files are completed with the prefixes 'XYZIN' and 
'XYZOUT'.  Below is an example:

pdbset XYZIN input.pdb XYZOUT output.pdb

So far I have,

local expl
_description files expl 'pdb files'
_path_files "$expl[@]" -g '*.pdb' || _path_files "$expl[@]" -/ -g 
'*.pdb'

I am having trouble inserting the prefixes.
Help is greatly appreciated.

Wataru Kagawa


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

* Re: filename completions with prefixes
  2005-01-17  6:23 filename completions with prefixes Wataru Kagawa
@ 2005-01-17 15:09 ` William Scott
  0 siblings, 0 replies; 2+ messages in thread
From: William Scott @ 2005-01-17 15:09 UTC (permalink / raw)
  To: Wataru Kagawa; +Cc: zsh-users


Hi Wataru:

Doubtless there are better ways, but one simple-minded
approach is to define a function pdbset that works with
your current completion:

#!/bin/zsh -f
function pdbset {
    command pdbset XYZIN $1 XYZOUT $2
}

The other alternative is to treat XYZIN as an argument
to be completed obligatorily at postion 1
(same with XYZOUT in position 3).

HTH,

Bill



On Mon, 17 Jan 2005, Wataru Kagawa wrote:

> I am trying to write a completion function for a command called pdbset
> in which *.pdb files are completed with the prefixes 'XYZIN' and
> 'XYZOUT'.  Below is an example:
>
> pdbset XYZIN input.pdb XYZOUT output.pdb
>
> So far I have,
>
> local expl
> _description files expl 'pdb files'
> _path_files "$expl[@]" -g '*.pdb' || _path_files "$expl[@]" -/ -g
> '*.pdb'
>
> I am having trouble inserting the prefixes.
> Help is greatly appreciated.
>
> Wataru Kagawa
>


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

end of thread, other threads:[~2005-01-17 23:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-17  6:23 filename completions with prefixes Wataru Kagawa
2005-01-17 15:09 ` William Scott

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