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

_arguments parsing of --help output



Many GNU commands include short options in the --help output as well as long
ones; e.g. `tar --help' emits lines like "-m, --modifcation-time ...".  The
code in _arguments accounts for this by splitting the line at commas, but
then discards the short form of the option.

Is there a reason that we don't attempt to complete the short forms as well?

I'm also curious in what circumstances the code to "... split the result
again at newlines after joining the old array elements with newlines
between them" ever makes a difference?  It strikes me as redundant.

More succinctly, what's wrong with the following reformulation of the
lopts assignment at lines 70-72 of _arguments?

    lopts=("-${(@)^${(@)${(@)${(@M)${(@)${(@M)${(@f)$(_call options ${~words[1]} --help 2>&1)//\[--/
--}:#[ 	]#-*}//,/
}:#[ 	]#-*}#*-}%%[]	 ]*}:#}")



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