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

Re: path PATH

On 2023-01-27 19:47, Bart Schaefer wrote:
typeset -ga VARIABLES=()
All of these are going to obscure the types of any variables in the
surrounding scope that share those names.  That's one reason I was
careful not to use any locals in my function.
I noticed that.  The only 'local's shown are the funcs internal ones.  Could give 'em names unlikely to be used elsewhere.  I've seen that sort of thing.  Or is there a better way?  Given the branching and switches, I can't think how to do it in one string of pipes w.o. intermediate variables.  And variables to hold the switches.

print -rl -- $VARIABLES | sed \
Does this do the right thing if you have a variable named $scalar (or
$array, etc.?)
I take it for granted that my colorizing and various condensations and formattings are always going to leak, but they're not mission critical just efforts to make things look better most of the time. When I find a leak I patch it if I can.  Still it's a good thing to do things in the most robust way of course.

It'd be better to convert the value of ${parameters[$1]} as you find
it, rather than build the whole output and then rewrite it.

Well, the paint isn't even dry on that effort I posted. Improvements most welcome.  As I have it now, it's just sequential thinking -- first  get the core functionality, then add the switches (case, etc.) then massage the output.  No doubt it can be handled better.  It's C- coding.

Anyway the whole exercise is just a 'cry for help' -- typeset -p (or typeset -P) should give us full disclosure.  display-params() should be hard coded and, IMHO, accessed via a switch to typeset. Wiser people disagree, but that's my two cents.  Nuts, there's already, what? three or five functions that sorta attempt to display this information but none of them shows it all.  Seems to me a full listing of params with *all* attributes and values is core functionality.

And the doc should discuss *all* the attributes in one place. Every last one. </whine> :-)

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