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

Re: setopt and alias questions

	for those who are interested, here's the final version
of my allopt function, which now can take arguments at the
command line to use as patterns for selecting which options
to display, and which uses bart's much nicer way of swapping
the on/off settings (or at least, the pre-3.1.5-pws-5 version
of bart's way):

allopt () {
   listalloptions () {
      builtin setopt localoptions kshoptionprint
      for OPT_PAIR in "${(f)$(builtin setopt)}" ; do
         OPT_VALUE=${OPT_PAIR##* }
         OPT_NAME=${OPT_PAIR%% *}
         if [[ ${OPT_NAME#no} != ${OPT_NAME} ]] ; then
            OPT_VALUE=${(L)${${OPT_VALUE:s/on/OFF}:s/off/on}} &&
         echo ${(r:21:)OPT_NAME} ${OPT_VALUE}
   if [[ -n $@ ]] ; then
      listalloptions | egrep "${@:s/ /|/}"
   else listalloptions

	and here's a quick completion hack, inside of an
anonymous code block so that localoptions will work:

   builtin setopt localoptions kshoptionprint
   optlist=("${${(f)$(builtin setopt)}%% *}")
   compctl -k optlist setopt allopt

	-- sweth.

Sweth Chandramouli
IS Coordinator, The George Washington University
<sweth@xxxxxxx> / (202) 994 - 8521 (V) / (202) 994 - 0458 (F)
<a href="http://astaroth.nit.gwu.edu/~sweth/disc.html";>*</a>

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