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

Re: completion: _normal after argument



On Jul 28,  9:12pm, Peter Stephenson wrote:
} Subject: Re: completion: _normal after argument
}
} On Mon, 28 Jul 2014 12:16:10 +0000 (UTC)
} > Essentially, I want to call of course _normal
} > (after cutting the "options+CMD" part from the words array and
} > decreasing the CURRENT parameter correspondingly).
} > But how to find where the "options+CMD" part has finished?
} 
} You can use _arguments -n.
} 
}    With the option -n, _arguments sets the parameter NORMARG to the
}    position of the first normal argument in the $words array

I found two examples of this in Completion/**/: _todo.sh and _zmodload.
Neither of them uses it to call _normal.

} Supposedly you don't even need to do that, however:
} 
}    *:::message:action
}           With  two  colons  before  the message, the words special
}           array and the CURRENT special parameter are  modified  to
}           refer  only  to  the  normal arguments when the action is
}           executed or evaluated.  With three colons before the mes-
}           sage  they are modified to refer only to the normal argu-
}           ments covered by this description.

Many examples of the '*::' form to call _normal.  None of the '*:::'
variety, for any purpose.

} I have a feeling I've had trouble with that in the past though (and,
} obviously, no one in their senses would try to understand _arguments).

This is all handled in C code in bin_comparguments anyway ... to be
specific, in parse_cadef.  Which looks like it should be doing the
right thing ...

Given the original usage, I'd start by trying '*:::command:->normal'
and see what happens.



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