E406 add a `set --show` flag · Issue #4265 · fish-shell/fish-shell · GitHub
[go: up one dir, main page]

Skip to content

add a set --show flag #4265

@krader1961

Description

@krader1961

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:

  1. any local vars it sets shadows those in the surrounding context, and
  2. you can't actually display the values of each scope since the $var syntax 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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0