-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
Many of us have written something like my show function:
$ show y
not set: local $y
not set: global $y
not set: universal $y
$ set -l y argle bargle
$ show y
set: local unexported $y count=2
$y[1] length=5 value=|argle|
$y[2] length=6 value=|bargle|
not set: global $y
not set: universal $y
However, this has at least two drawbacks:
- any local vars it sets shadows those in the surrounding context, and
- you can't actually display the values of each scope since the
$varsyntax provides no way to ask for the value(s) from a specific scope.
These drawbacks means it is much harder to give simple commands to help someone understand why their set commands aren't having the desired outcome. Such as in issue #4263. So I propose adding -S/--show flags to set to do the same thing as my show function but without the drawbacks. This would also be extremely useful in our unit tests where we also have a show function and employ other techniques to determine if a var is (un)set correctly.
Reactions are currently unavailable