diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 1999-06-08 09:25:39 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 1999-06-08 09:25:39 +0000 |
commit | 805381040dd69dd02b78423d2d71913b33f3cc33 (patch) | |
tree | 1fa89ee643e8e577a2f79e76e3d6cafc93256ca2 /Functions/Misc/allopt | |
parent | f42e3fa8e6152e145251e8f16f4c61c23dec1f59 (diff) | |
download | zsh-805381040dd69dd02b78423d2d71913b33f3cc33.tar.gz zsh-805381040dd69dd02b78423d2d71913b33f3cc33.tar.xz zsh-805381040dd69dd02b78423d2d71913b33f3cc33.zip |
zsh-3.1.5-pws-21 zsh-3.1.5-pws-21
Diffstat (limited to 'Functions/Misc/allopt')
-rw-r--r-- | Functions/Misc/allopt | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Functions/Misc/allopt b/Functions/Misc/allopt new file mode 100644 index 000000000..604e76198 --- /dev/null +++ b/Functions/Misc/allopt @@ -0,0 +1,29 @@ +# This function lists options with the no's in front removed for +# improved comprehension, i.e. `norcs off' becomes `rcs on'. +# The format is otherwise like that with `kshoptionprint' set, +# i.e. you can see all options whether on or off. +# It can take a list of option names or parts thereof to search for +# via egrep. +# +# Written by Sweth Chandramouli with hacks by Bart Schaefer. + +listalloptions () { + emulate -R zsh + builtin setopt localoptions kshoptionprint + local OPT_NAME OPT_PAIR OPT_VALUE + 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 "${(j.|.)@}" +else + listalloptions +fi |