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

zsh[modules]/zutil: zparseopts should parse alternate long options



Hi,

zsh/zutil is handy to get a nice parse option utilities and, in fact,
I use it often in scripts which permit to limit dozen of lines to just
parse options with getopt from GNU util-linux package. And once one
get used to it, one do not want to write again and again that long:
while [[ $# >0 ]]; do
case $1 in
   -o|--option) some_variable_asignement; shift;;
  ...
esac
done

case assignement.

Now, it would be nice if an alternate long option e.g. `-option'
instead of the GNU style `--option' would work, because in the present
day, if the first letter of a long option name is a short option name,
the long option would never be parsed as one would expect. So one
should use extra `-' hyphens to get his/her long option parsed, so to
speak, to use a la GNU style long option way.

Thanks.



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