fish-shell icon indicating copy to clipboard operation
fish-shell copied to clipboard

Feature: Highlight environment variables that are not set

Open thernstig opened this issue 3 years ago • 2 comments

fish, version 3.4.1 Linux userA-dev 5.4.0-113-generic #127-Ubuntu SMP Wed May 18 14:30:56 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux xterm-256color

Feature request

Consider this example:

helm pull https://some.com/path/helmchart.tgz --username $FOO --password $MOO

I have accidentally pulled up this line from my history, but forgot I had removed the $MOO variable. $FOO and $MOO is of another color:

image

To me it would be quite cool if fish could show these as crossed-over text, or of another much more faded color, or similar. To show me that those variables do not exist and are unset. That would have helped me find my fault. When I executed the above command I did get a 401 back but I never figured it was because they were unset.

thernstig avatar Sep 02 '22 11:09 thernstig

To be clear, using an undefined variable is not an error. Though I agree it often is, so a different color seems desirable. However multiline commands (via set or for) often define a new variable for immediate use. Our highlighter currently can't detect that fully. I guess we could extend our partial solution from fffcdf8792ecb5ebcf230cc533238ca8dcc5a7f6. Not sure if this is worth it.

krobelus avatar Sep 02 '22 12:09 krobelus

@krobelus agree it is not an error per see. Also understand it can be hard in the instances you describe.

But if if it was feasible to implement in some way in the scenario above, I think it would add value to fish as a shell, and I think others would too.

thernstig avatar Sep 02 '22 13:09 thernstig