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

Re: Globbing on what the completion function would suggest?



On Oct 19, 11:26pm, Richard Hartmann wrote:
}
} I should have been clearer in my initial email: I don't want to do
} this interactively, I want to do this on the CLI or in a script.

In order to do this, you'd have to write a wrapper function that sets
up a fake completion context (the compstate hash, the words array,
the values of all the ZLE special variables, and so on), and that
also defines compset and compadd functions, etc.  Then you'd have to
examine whatever arguments were passed to your dummy compadd after
you invoke the completer function.

Or equivalently you need to re-implement all the completion modules in
non-interactive versions that don't need the ZLE line context.

A third possibility is to do what comptest.zsh in the test suite does:
Create a psuedo-terminal with zpty running an interactive shell, send
it a partial command line and a list-choices keystroke to produce a
completion listing, and then read back the results.



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