zsh-users
 help / color / mirror / code / Atom feed
From: Sweth Chandramouli <sweth@astaroth.nit.gwu.edu>
To: zsh-users@sunsite.auc.dk
Subject: Re: setopt and alias questions
Date: Mon, 8 Feb 1999 14:46:23 -0500	[thread overview]
Message-ID: <19990208144623.B4151@astaroth.nit.gwu.edu> (raw)
In-Reply-To: <19990208141534.A4151@astaroth.nit.gwu.edu>

	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}} &&
               OPT_NAME=${OPT_NAME#no};
         fi;
         echo ${(r:21:)OPT_NAME} ${OPT_VALUE}
      done
   };
   if [[ -n $@ ]] ; then
      listalloptions | egrep "${@:s/ /|/}"
   else listalloptions
   fi;
}

	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@gwu.edu> / (202) 994 - 8521 (V) / (202) 994 - 0458 (F)
<a href="http://astaroth.nit.gwu.edu/~sweth/disc.html">*</a>


  parent reply	other threads:[~1999-02-08 19:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-08  0:37 Sweth Chandramouli
1999-02-08  1:59 ` Bart Schaefer
1999-02-08  4:52   ` Sweth Chandramouli
1999-02-08  7:33     ` Bart Schaefer
1999-02-08 15:30       ` Sweth Chandramouli
1999-02-08 18:45         ` Bart Schaefer
1999-02-08 19:15           ` Sweth Chandramouli
1999-02-08 19:44             ` Bart Schaefer
1999-02-08 19:59               ` Sweth Chandramouli
1999-02-08 20:55                 ` Bart Schaefer
1999-02-12 19:34                   ` Sweth Chandramouli
1999-02-12 20:13                     ` Bart Schaefer
1999-02-08 19:46             ` Sweth Chandramouli [this message]
1999-02-08 20:30               ` Bart Schaefer
1999-02-09  8:40                 ` Phil Pennock

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19990208144623.B4151@astaroth.nit.gwu.edu \
    --to=sweth@astaroth.nit.gwu.edu \
    --cc=zsh-users@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).