From: Bart Schaefer <schaefer@brasslantern.com>
To: Ray Andrews <rayandrews@eastlink.ca>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Which options are really doing anything (Re: Globbing symlinks-to-${glob_qualifier})
Date: Wed, 18 Aug 2021 15:28:55 -0700 [thread overview]
Message-ID: <CAH+w=7aY+G97iYNvw_3UaFBkoW4bnG9QpZvH2Fx8n-wjz+kkiw@mail.gmail.com> (raw)
In-Reply-To: <4b7028ed-689d-fae9-0253-a6b301a1cdbc@eastlink.ca>
On Wed, Aug 18, 2021 at 10:56 AM Ray Andrews <rayandrews@eastlink.ca> 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.
next prev parent reply other threads:[~2021-08-18 22:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-18 3:27 Globbing symlinks-to-${glob_qualifier} Zach Riggle
2021-08-18 3:57 ` Daniel Shahaf
2021-08-18 4:02 ` Bart Schaefer
2021-08-18 13:10 ` Zach Riggle
2021-08-18 15:24 ` Bart Schaefer
2021-08-18 16:48 ` Ray Andrews
2021-08-18 17:23 ` Bart Schaefer
2021-08-18 17:55 ` Ray Andrews
2021-08-18 22:28 ` Bart Schaefer [this message]
2021-08-18 23:27 ` Which options are really doing anything (Re: Globbing symlinks-to-${glob_qualifier}) Ray Andrews
2021-08-19 2:32 ` Globbing symlinks-to-${glob_qualifier} Zach Riggle
2021-08-19 4:38 ` Lawrence Velázquez
2021-08-19 13:23 ` Daniel Shahaf
2021-08-19 13:25 ` Daniel Shahaf
2021-08-19 14:38 ` Ray Andrews
2021-08-19 13:54 ` Daniel Shahaf
2021-08-19 4:40 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAH+w=7aY+G97iYNvw_3UaFBkoW4bnG9QpZvH2Fx8n-wjz+kkiw@mail.gmail.com' \
--to=schaefer@brasslantern.com \
--cc=rayandrews@eastlink.ca \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).