3 ms·
Abuse ZSH Parameter Expansion to Expand GNU-Style Arguments
- nerdponx 2y agoFor 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#index-zparseopts 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_zparseopts/?rdt=46206 https://old.reddit.com/r/zsh/comments/s09vot/using_zparseopt... https://gist.github.com/mattmc3/804a8111c4feba7d95b6d7b984f12a53 https://gist.github.com/mattmc3/804a8111c4feba7d95b6d7b984f1... https://xpmo.gitlab.io/post/using-zparseopts/ https://xpmo.gitlab.io/post/using-zparseopts/
- nerdponx 2y agoI just realized that this actually would/should have solved OP's problem on MinGW, because zparseopts doesn't require calling out to a subshell. That's kind of ironic: they didn't realize that their solved problem was that solved.
- mdip 2y agoIIRC there was something with the way zparseopts worked that caused it to not be able to parse the CLI I had setup -- I can't remember what the drawback was, though, and it's one of those one-liners I've just used blindly after I got it to work. :)