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

Dispatch completion after some arguments



Hi,

I’m working on a zsh completion for Bastille. This command has subcommands, one of them being called pkg, which will call the pkg command in a FreeBSD jail.

bastille pkg JAIL ARGS

So the goal is that ARGS will be completed as if it’s in the context of the pkg command:

pkg ARGS

At the moment I’m experimenting here: https://github.com/pepe82sh/bastille/blob/71134e4a8c5ad32e1c8a38185d9f8fd6a0a75e46/usr/local/share/zsh/site-functions/_bastille, specifically line 187.
(I’m aware that code is unclean and has case commands where ifs would be sufficient, but it’s WIP and will be cleaned up when functionally working properly.)

This is not working, but if I call _dispatch at the start of the file, or in a subcommand directly, it seems to work fine, just on the wrong position in the command. I’m out of ideas how to approach this, and wanted to know if this is feasible at all, and if yes, if anyone can nudge me into the right direction.

Thanks for reading this far,
Michael




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