Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: setopt and alias questions
- X-seq: zsh-users 2121
- From: Sweth Chandramouli <sweth@xxxxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxxxxxx
- Subject: Re: setopt and alias questions
- Date: Mon, 8 Feb 1999 14:46:23 -0500
- In-reply-to: <19990208141534.A4151@xxxxxxxxxxxxxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <19990207193735.A2060@xxxxxxxxxxxxxxxxxxxx> <990207175931.ZM8940@xxxxxxxxxxxxxxxxxxxxxxx> <19990207235214.A2653@xxxxxxxxxxxxxxxxxxxx> <990207233343.ZM10079@xxxxxxxxxxxxxxxxxxxxxxx> <19990208103038.A3447@xxxxxxxxxxxxxxxxxxxx> <990208104550.ZM14297@xxxxxxxxxxxxxxxxxxxxxxx> <19990208141534.A4151@xxxxxxxxxxxxxxxxxxxx>
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@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