Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Which options are really doing anything (Re: Globbing symlinks-to-${glob_qualifier})



On Wed, Aug 18, 2021 at 10:56 AM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> Still one might wish for some way of seeing what's actually
> active at any given time.  'setopt' shows us 'on' or 'off', but not
> 'disabled'.

Something like the following ... so far this covers only the
globbing-related options; if somebody wants to fill in as many of the
other 172 options as need this, be my guest:

optset () {
  local o
  local -A optset=("${(kv)options[@]}")
  for o in "${(k)options[@]}"
  do
    case $o in
      (bareglobqual) [[ -o noglob ]] && optset[$o]=ignored  ;;
      (numericglobsort) [[ -o noglob ]] && optset[$o]=ignored  ;;
      (globstarshort) [[ -o noglob ]] && optset[$o]=ignored  ;;
      (globsubst) [[ -o noglob ]] && optset[$o]=ignored  ;;
      (globdots) [[ -o noglob ]] && optset[$o]=ignored  ;;
      (extendedglob) [[ -o noglob ]] && optset[$o]=ignored  ;;
      (dotglob) [[ -o noglob ]] && optset[$o]=ignored  ;;
      (caseglob) [[ -o noglob ]] && optset[$o]=ignored  ;;
      (cshnullglob) [[ -o noglob || -o nullglob ]] && optset[$o]=ignored  ;;
      (nullglob) [[ -o noglob ]] && optset[$o]=ignored  ;;
      (kshglob) [[ -o noglob ]] && optset[$o]=ignored  ;;
      (shglob) [[ -o kshglob ]] && optset[$o]=partial
        [[ -o noglob ]] && optset[$o]=ignored  ;;
      (nomatch) [[ ! -o badpattern ]] && optset[$o]=partial
        [[ -o nullglob || -o cshnullglob ]] && optset[$o]=ignored  ;;
    esac
  done
  print -aC2 "${(kv)optset[@]}"
}

If you can think of a better description than "partial" for how shglob
works with kshglob, or for how nomatch interacts with nobadpattern,
jump in there, too.

Aside:  Although the doc says --
"Some options have alternative names.  These aliases are never used
for output, but can be used just like normal option names when
specifying options to the shell."
-- those alternative names actually do appear in the $options hash,
for example globdots and dotglob above.  That accounts for 11 of the
172.




Messages sorted by: Reverse Date, Date, Thread, Author