diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 1999-06-08 09:26:01 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 1999-06-08 09:26:01 +0000 |
commit | fcd7cd1cfa2ba286f4bf73da7a60116cd3912629 (patch) | |
tree | d2aa5a9369bf3af8841d3abde69f52bd483f5526 /Functions/Misc/allopt | |
parent | b39cafaa22ad7efc2ac4b64a5eeac8f49bc80e00 (diff) | |
download | zsh-fcd7cd1cfa2ba286f4bf73da7a60116cd3912629.tar.gz zsh-fcd7cd1cfa2ba286f4bf73da7a60116cd3912629.tar.xz zsh-fcd7cd1cfa2ba286f4bf73da7a60116cd3912629.zip |
Initial revision
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 |