Pass Arguments to zsh Functions with zparseopts

InstructorJohn Lindquist

Share this video with your friends

Send Tweet

Parsing arguments in zsh functions can be a bit difficult to manage if you try and customize it for each new function. Luckily, that's where zparseopts comes in. zparseopts is a utility function which can parse out each of the arguments you define and store them inside of an associative array for easy access. This makes accessing arguments as easy as looking them up by name.