1# This function lists options with the no's in front removed for
2# improved comprehension, i.e. `norcs off' becomes `rcs on'.
3# The format is otherwise like that with `kshoptionprint' set,
4# i.e. you can see all options whether on or off.
5# It can take a list of option names or parts thereof to search for
6# via egrep.
7#
8# Written by Sweth Chandramouli with hacks by Bart Schaefer.
9
10listalloptions () {
11   local OPT_NAME OPT_VALUE
12   builtin set -o | while read OPT_NAME OPT_VALUE ; do
13      if [[ ${OPT_NAME#no} != ${OPT_NAME} ]] ; then
14	 OPT_VALUE=${(L)${${OPT_VALUE:s/on/OFF}:s/off/on}}
15	 OPT_NAME=${OPT_NAME#no}
16      fi
17      echo "${(r:21:)OPT_NAME} ${OPT_VALUE}"
18   done
19}
20
21if [[ -n $@ ]]; then
22    listalloptions | egrep "${(j.|.)@}"
23else
24    listalloptions
25fi
26