Add --no-newline option to nu (#12410)

# Description
I have `nu` set as my shell in my editor, which allows me to easily pipe
selections of text to things like `str pascal-case` or even more complex
string operation pipelines, which I find super handy. However, the only
annoying thing is that I pretty much always have to add `| print -n` at
the end, because `nu` adds a newline when it prints the resulting value.

This adds a `--no-newline` option to stop that from happening, and then
you don't need to pipe to `print -n` anymore, you can just have your
shell command for your editor contain that flag.

# User-Facing Changes
- Add `--no-newline` command line option

# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`
This commit is contained in:
Devyn Cairns
2024-04-09 07:04:00 -07:00
committed by GitHub
parent 00b3a07efe
commit 14b0ff3f05
6 changed files with 41 additions and 6 deletions

View File

@@ -85,6 +85,7 @@ fn bench_command_with_custom_stack_and_engine(
&mut stack.clone(),
PipelineData::empty(),
None,
false,
)
.unwrap();
})
@@ -104,6 +105,7 @@ fn setup_stack_and_engine_from_command(command: &str) -> (Stack, EngineState) {
&mut stack,
PipelineData::empty(),
None,
false,
)
.unwrap();
@@ -263,6 +265,7 @@ mod eval_commands {
&mut nu_protocol::engine::Stack::new(),
PipelineData::empty(),
None,
false,
)
.unwrap();
})