nerdponx an hour ago

For anyone wondering what the solution is to this "solved problem": zparseopts, which ships with Zsh. Manual: https://zsh.sourceforge.io/Doc/Release/Zsh-Modules.html#inde...

As usual with Zsh, it can take a few hours of studying the docs to really make sense of it, but is well worth spending the time on. It's one of the reasons Zsh is actually usable for nontrivial scripting.

Some more usage advice:

https://old.reddit.com/r/zsh/comments/s09vot/using_zparseopt...

https://gist.github.com/mattmc3/804a8111c4feba7d95b6d7b984f1...

https://xpmo.gitlab.io/post/using-zparseopts/