Skip to content

Improve erroring of config nu and config env - #6730

Merged
fdncred merged 2 commits into
nushell:mainfrom
merelymyself:main
Oct 15, 2022
Merged

fdncred merged 2 commits into
nushell:mainfrom
merelymyself:main

Conversation

@merelymyself

@merelymyself merelymyself commented Oct 15, 2022 •

Copy link
Copy Markdown
Contributor

Description

Related: #6646. Edited for clarity.

Error after change:

~/CodingProjects/nushell〉config nu           
Error: nu::shell::external_command (link)

  × External command failed
   ╭─[entry #1:1:1]
 1 │ config nu
   · ────┬────
   ·     ╰── executable 'notepad' was not found
   ╰────
  help: No such file or directory (os error 2)

~/CodingProjects/nushell〉config env       
Error: nu::shell::external_command (link)

  × External command failed
   ╭─[entry #2:1:1]
 1 │ config env
   · ─────┬────
   ·      ╰── executable 'notepad' was not found
   ╰────
  help: No such file or directory (os error 2)

Tests

Make sure you've done the following:

  • Add tests that cover your changes, either in the command examples, the crate/tests folder, or in the /tests folder.
  • Try to think about corner cases and various ways how your changes could break. Cover them with tests.
  • If adding tests is not possible, please document in the PR body a minimal example with steps on how to reproduce so one can verify your change works.

Make sure you've run and fixed any issues with these commands:

  • cargo fmt --all -- --check to check standard code formatting (cargo fmt --all applies these changes)
  • cargo clippy --workspace --features=extra -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect to check that you're using the standard code style
  • cargo test --workspace --features=extra to check that all the tests pass

@WindSoilder

WindSoilder commented Oct 15, 2022 •

Copy link
Copy Markdown
Contributor

Hi, I've a simple question..why I type nu but report notepad... I'm not sure if I get the idea..

@merelymyself
merelymyself marked this pull request as draft October 15, 2022 04:09
@merelymyself merelymyself changed the title Improve errors regarding external commands Improve erroring of config nu and config env Oct 15, 2022
@merelymyself
merelymyself marked this pull request as ready for review October 15, 2022 09:00
@fdncred

fdncred commented Oct 15, 2022 •

Copy link
Copy Markdown
Contributor

@WindSoilder I believe notepad is used on Windows if no other editor is found in $env.EDITOR, buffer_editor and $env.VISUAL and if notepad isn't found either, you get this message that @merelymyself is showing. So, I think it's a good change to say what exactly is not found. For instance, mine is set to hx and if hx is not found, it should say that.

@fdncred

fdncred commented Oct 15, 2022

Copy link
Copy Markdown
Contributor

thanks

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.

3 participants