1

I'm writing an autocomplete script for supervisorctl.

Is it possible to complete a numeric parameter such as -6, -999 etc?

Currently my call to _arguments looks like, which doesn't work:

_arguments \
  '--[last N bytes of process stdout]:number'

The first dash is the pattern to match, and the second dash indicates the argument must be in the same word.. But obv this clashes with a normal double dash argument.

EDIT: perhaps this will better explain what I want to do. The following illustrates what I want to happen at the cli:

> supervisorctl tail -<TAB>
 -- option --
-     -- last N bytes of process stdout
-f    -- Continuous tail of named process stdout

This above is what currently happens in my script. I select the first item in the option list, and get this:

> supervisorctl tail - <CURSOR>

I believe a trailing - will leave the cursor adjacent to the dash. How can I encode that in the parameter definition?

A work-in-progress for this can be found at:

https://github.com/mafrosis/zsh-completions/blob/supervisorctl/src/_supervisorctl

3
  • I don't understand: what would be the possible completions? Wouldn't any digit be valid at any point? Feb 8, 2015 at 23:13
  • Correct. ZSH doesn't need to complete the number, but it does need to correctly prompt the user with the message and expect a number immediately after the dash.
    – mafrosis
    Feb 8, 2015 at 23:55
  • @Gilles I've updated the question to be more specific
    – mafrosis
    Feb 9, 2015 at 1:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.