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

Re: Q: _regex_arguments problem



On Fri, 02 Dec 2011 10:14:28 -0800
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Dec 2,  9:37pm, Alexey I. Froloff wrote:
> }
> } I've found so far, that the only utility function, that can
> } complete anything-but-space-separated list of values is _values.
> } And it accepts only predefined values.  My list of ids is not
> } static, it is fetched from remote server via executing special
> } ssh command, so I guess this problem is not related to _regex_*
> } completion, this is just not possible...
> 
> The typical way you'd do this with the plain _arguments function
> is with the ->state mechanism:  use _arguments to figure out the
> context and set a state, then in a 'case' or the like on the state
> value you call your ssh command to get the list of values and then
> call _values with that.

The documentation says the actions supported by _regex_arguments are the
same as those supported by _arguments, although I didn't try it; in nay
case I don't see why you shouldn't use a function to complete for the
context, either.

You'll probably need to make _regex_arguments skip up to the last comma,
so you don't need to figure out a valid last of values until you know
you're trying to complete one.  I think _ip does that sort of thing.

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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