nushell/crates/nu-cli/src
Douglas d702c4605a
Increment SHLVL before run_repl() (#14732)
# Description

A follow-on to #14727:

* Instead of using `is-interactive` as the trigger for incrementing
`SHLVL`, this change puts the increment logic just before `run_repl()`
is called.
* Tests are changed to use `-e`
* Moves the `confirm_stdin_is_terminal()` call immediately **after** the
`prerun_cmd` (which executes `--execute (-e) <commandstring>`. The fact
that it was **before** that call seems to be a bug, since the error
message says *"or provide arguments to invoke a script"* even if
`--execute` was used. This change enables REPL testing using `--execute
(-e)`.
* Added a test to ensure `-c` does *not* increment SHLVL.

# User-Facing Changes

`$env.SHLVL` runs before the REPL is started, rather than when
`is-interactive`

# Tests + Formatting

- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`

# After Submitting

N/A
2025-01-03 15:16:57 -06:00
..
commands Remove as_i64 and as_f64 (#14258) 2024-11-05 09:28:56 +01:00
completions Create nu_glob::is_glob function (#14717) 2025-01-01 19:04:17 -05:00
menus Replace raw usize IDs with new types (#13832) 2024-09-30 13:20:15 +02:00
config_files.rs Add auto option for config.use_ansi_coloring (#14647) 2024-12-26 11:00:01 -06:00
eval_cmds.rs Turn compile errors into fatal errors (#14388) 2024-11-20 19:24:03 +08:00
eval_file.rs Turn compile errors into fatal errors (#14388) 2024-11-20 19:24:03 +08:00
lib.rs Set current working directory at startup (#12953) 2024-09-25 13:04:26 -05:00
nu_highlight.rs Change the usage misnomer to "description" (#13598) 2024-08-22 12:02:08 +02:00
print.rs Rely on display_output hook for formatting values from evaluations (#14361) 2024-11-19 21:04:29 +08:00
prompt_update.rs stop the prompt from removing the last newline (#14590) 2025-01-02 09:48:35 -06:00
prompt.rs Make get_env_var return a reference to a Value (#13987) 2024-10-02 13:05:48 +02:00
reedline_config.rs Cut down unnecessary lint allows (#14335) 2024-11-15 19:24:39 +01:00
repl.rs Increment SHLVL before run_repl() (#14732) 2025-01-03 15:16:57 -06:00
syntax_highlight.rs Remove unused FlatShapes And/Or (#14476) 2024-11-29 22:23:40 +01:00
util.rs Add auto option for config.use_ansi_coloring (#14647) 2024-12-26 11:00:01 -06:00
validation.rs Remove old alias implementation (#8797) 2023-04-07 21:09:38 +03:00