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

Completing option/value pairs without space



Hello.

I am currently defining a _ecasound autoload function.

A typical command line of ecasound looks like this:
ecasound -d:3 -a:1 -i myfile.wav -efs:100,50 -kl:1,100,5000,10 -a:all -o /dev/dsp

relevant parts of the manpage are:
NAME
       ecasound  - sample editor, multitrack recorder, fx-proces-
       sor, etc.

SYNOPSIS
       ecasound  [  general_options  ]  {  [  chain_setup   ]   [
       effect_setup ] [ input_setup ] [ output_setup ] }

OPTIONS
       Notice  that  the order of parameters given on the command
       line is important!

       GLOBAL OPTIONS

       -d:debug_level
              Set  the  debug level to 'debug_level'. This a bit-
              masked value, that defaults  to  3.  See  ECA_DEBUG
              class  documentation  for  more detailed info about
              various debug_level values.

       GENERAL

       -a:chainname1, chainname2, ...
              Select active signal chains.  All  effects,  inputs
              and  outputs are assigned to these chains. If there
              are no -a options given,  default  chain  is  used.
              Chain  name  'all'  is  reserved and means that all
              chains are selected. By giving multiple -a options,
              you can control to which chains effects, inputs and
              outputs are assigned to. Look at the EXAMPLES  sec-
              tion for more detailed info about the usage of this
              option.

       EFFECT SETUP

       FILTER EFFECTS

       -efs:center-freq,width
              Resonator.  'center_freq'  is the center frequency.
              Width is specified in Hz. Basicly just another res-
              onating bandpass filter.

For the rest of the stuff, go figure.

I tried to use the _arguments function, but I came across
a problem which someone here perhaps can cast a little light on:

The colon and the comma should be regarded as separators.
Here is my current code:

#compdef ecasound

local context state line
typeset -A opt_args

_arguments \
  '-c[Start in interactive mode]' \
  '-d\:[Debug level]:Debug level:' \
  '-D[Print all debug information to stderr]' \
  '-q[Quiet mode, no output]' \
  '--help[Show help]' \
  '--version[Show version information]' \
  '-n\:[Set the name of chainsetup]' \
  '-s\:[Create a new chainsetup from file]:filename:_files' \
  '-sr\:[Set internal sampling rate]:Sampling rate:(8000 11025 22050 44100 48000)'

When I now e.g. do:
ecasound -sr:<TAB>
i get a space, and when hitting tab again, I get the sampling rates for completion.

The same problem would strike when I come to the more complicated
effects. e.g. I would like to have:
ecasound ... -efs:<TAB>
and get
-efs: -- Resonator center freq

and when doing
ecasound ... -efs:100,<TAB>
Id like to get
-efs:*, -- resonator width

And a really reall neat(tm) gadget would be:
ecasound ... -efs:100,50 -kl:<TAB>
should give
-kl:1 -- Linear controller controlling Resonator freq
-kl:2 -- Linear controller controlling Resonator width

and so on.

Is this possible with current completion system?
Ecasound has so many different command line parameters that
such type of completion would be necessary. Otherwise the completion
for ecasoud will not improve usability a lot...

Any hints here?

  

-- 
CYa,
   Mario <mlang@xxxxxxxxxxx>
Homepage(s): http://delysid.org | http://piss.at/



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