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

Re: filename completions with prefixes



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
>



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