From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: color
Date: Sat, 4 Feb 2023 08:00:57 -0800 [thread overview]
Message-ID: <10bbd1e3-ba0d-08e2-8a4a-830768c2ce70@eastlink.ca> (raw)
In-Reply-To: <CAH+w=7Ype9eFZg=-bU1nSiZ2K_b_Za+rF9cJE3gjGALFf6Zdqg@mail.gmail.com>
On 2023-02-03 20:25, Bart Schaefer wrote:
> The first thing you should do is try to get rid of the calls to "sed".
> You'll be happier in the long run if you don't have to keep adding
> increasingly baroque regular expressions.
I'm happy with the condensation to single letter identifiers, it keeps
the display narrow and justified. I had thought/hoped/wanted 'typeset
-mp' to show them but it doesn't. And it makes it easy to see
patterns. Probably better done with native zsh replacements tho. I
have it so you can optionally view the entire string too. Very nice to
have that. Self-explaining output. This is zsh being friendly.
2 /aWorking/Zsh/Source/Wk 0 $ . v; v ,f z*
scalar: Z = /aWorking/Zsh
array: zle_bracketed_paste = ( $'\C-[[?2004h' $'\C-[[?2004l' )
scalar: ZSH_ARGZERO = zsh
scalar: ZSHBOOT = /aWorking/Zsh/Boot
scalar-readonly-tied-special: ZSH_EVAL_CONTEXT = toplevel:shfunc:cmdsubst
array-readonly-tied-special: zsh_eval_context = ( toplevel shfunc
cmdsubst )
scalar: ZSH_NAME = zsh
scalar: ZSH_PATCHLEVEL = debian/5.8-6+deb11u1
array-readonly-hide-hideval-special: zsh_scheduled_events = !hidden!
integer-readonly-special: ZSH_SUBSHELL = 1
scalar: ZSH_VERSION = 5.8
2 /aWorking/Zsh/Source/Wk 0 $ . v; v z*
S Z = /aWorking/Zsh
A zle_bracketed_paste = ( $'\C-[[?2004h' $'\C-[[?2004l' )
S ZSH_ARGZERO = zsh
S ZSHBOOT = /aWorking/Zsh/Boot
Srts ZSH_EVAL_CONTEXT = toplevel:shfunc:cmdsubst
Arts zsh_eval_context = ( toplevel shfunc cmdsubst )
S ZSH_NAME = zsh
S ZSH_PATCHLEVEL = debian/5.8-6+deb11u1
Arhvs zsh_scheduled_events = !hidden!
Irs ZSH_SUBSHELL = 1
S ZSH_VERSION = 5.8
> It's not unique, it's an associative array. Variables like "commands"
> (after loading from zsh/parameter module) will show up the same way.
Ok, I'll be on the lookout for others like that. There's a dozen AAs
but none of them display that way -- that I've seen. 'color' seemed
unique in how it displays.
> You're going to have to have separate cases for each of
> scalar/array/associative. To get both the keys and the values of an
> associate array, you need ${(kv)aary}.
Probably not worth the trouble, I was just trying to duplicate 'typeset
-m' output via other means and the alternate line I showed comes very
close. I've learned to avoid subshells if I can. In this case I was
just curious about 'print $color' and indeed 'print ${(kv)color}' shows
sensible output -- I should have known that -- but I'm not going to
attempt separate code for different types. 'typeset -m' is fine tho a
bit slower.
> This set of threads has gone on long enough, the whole point of your
> function is to show you parameter type information so start paying
> attention to what's different about THAT and you'll make more
> progress.
It's basically finished. I was just curious about 'colors'.
prev parent reply other threads:[~2023-02-04 16:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-04 0:21 color Ray Andrews
2023-02-04 4:25 ` color Bart Schaefer
2023-02-04 16:00 ` Ray Andrews [this message]
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=10bbd1e3-ba0d-08e2-8a4a-830768c2ce70@eastlink.ca \
--to=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).