2
0
Fork 0
mirror of https://github.com/nushell/nushell synced 2025-02-15 21:48:29 +00:00
nushell/crates/nu-utils/src
goldfish 71b4949843
Change default config to display failed LAST_EXIT_CODE ()
# Description

fixed  
Change default nushell configuration file `default_env.nu` to display
LAST_EXIT_CODE in the prompt. For this change, users can quickly know
that a previous command failed.

# User-Facing Changes

This change affects only users who use the default configuration.
When a command fails, the exit code is displayed in the prompt like
these figures.
* before

![image](https://user-images.githubusercontent.com/37319612/229782830-45bc6b0d-75e4-459f-ae1d-46877f740239.png)
* after

![image](https://user-images.githubusercontent.com/37319612/229784089-e68b5d14-499b-4448-b764-e6b30ca64714.png)


# Tests + Formatting

When I ran tests, `test.nu` failed with the following error.
The error also occurs in the master branch, so it's probably unrelated
to these changes.
Do I need to address it?

* `cargo fmt --all -- --check`: passed
* `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect`: passed
* `cargo test --workspace`: passed
* `cargo run -- crates/nu-utils/standard_library/tests.nu`: ~failed~
passed
```
~/oss_dev/nushell> cargo run -- crates/nu-utils/standard_library/tests.nu
    Finished dev [unoptimized + debuginfo] target(s) in 0.15s
     Running `target/debug/nu crates/nu-utils/standard_library/tests.nu`
Error: nu:🐚:external_command

  × External command failed
    ╭─[/home/hiroki/oss_dev/nushell/crates/nu-utils/standard_library/tests.nu:73:1]
 73 │         | upsert test {|module|
 74 │             nu -c $'use ($module.file) *; $nu.scope.commands | select name module_name | to nuon'
    ·             ─┬
    ·              ╰── did you mean 'du'?
 75 │             | from nuon
    ╰────
  help: No such file or directory (os error 2)
  ```

# After Submitting

nothing
2023-04-05 13:06:24 -05:00
..
sample_config Change default config to display failed LAST_EXIT_CODE () 2023-04-05 13:06:24 -05:00
ctrl_c.rs Add helper method to check whether ctrl+c was pressed, adopt it () 2022-12-15 09:39:24 -08:00
deansi.rs Refactor ansi stripping into nu-utils functions () 2022-11-05 07:49:45 +13:00
lib.rs color_config now accepts closures as color values () 2022-12-17 07:07:56 -06:00
locale.rs Reduce again the number of match calls () 2023-01-24 12:23:42 +01:00
main.rs added nu-utils crate, fixed issue where externals turn off vt processing () 2022-03-16 17:21:06 -05:00
utils.rs enable error reporting from enable_vt_processing () 2023-03-16 17:48:21 -05:00