Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error message if env var is used as var #9522

Merged
merged 1 commit into from Jun 25, 2023

Conversation

sophiajt
Copy link
Member

@sophiajt sophiajt commented Jun 25, 2023

Description

This PR improves the error message if an environment variable (that's visible before the parser begins) is used in the form of $PATH instead of $env.PATH.

Before:

Error: nu::parser::variable_not_found

  × Variable not found.
   ╭─[entry #31:1:1]
 1 │ echo $PATH
   ·      ──┬──
   ·        ╰── variable not found.
   ╰────

After:

Error: nu::parser::env_var_not_var

  × Use $env.PATH instead of $PATH.
   ╭─[entry #1:1:1]
 1 │ echo $PATH
   ·      ──┬──
   ·        ╰── use $env.PATH instead of $PATH
   ╰────

User-Facing Changes

Just the improvement to the error message

Tests + Formatting

After Submitting

Copy link
Member

@amtoine amtoine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loving this 👌

@sophiajt sophiajt merged commit 33535c5 into nushell:main Jun 25, 2023
17 of 20 checks passed
@sophiajt sophiajt deleted the env_var_not_var branch June 25, 2023 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants