forked from extern/nushell
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:
@ -15,6 +15,7 @@ pub fn evaluate_commands(
|
||||
stack: &mut Stack,
|
||||
input: PipelineData,
|
||||
table_mode: Option<Value>,
|
||||
no_newline: bool,
|
||||
) -> Result<Option<i64>> {
|
||||
// Translate environment variables from Strings to Values
|
||||
if let Some(e) = convert_env_values(engine_state, stack) {
|
||||
@ -60,7 +61,13 @@ pub fn evaluate_commands(
|
||||
if let Some(t_mode) = table_mode {
|
||||
config.table_mode = t_mode.coerce_str()?.parse().unwrap_or_default();
|
||||
}
|
||||
crate::eval_file::print_table_or_error(engine_state, stack, pipeline_data, &mut config)
|
||||
crate::eval_file::print_table_or_error(
|
||||
engine_state,
|
||||
stack,
|
||||
pipeline_data,
|
||||
&mut config,
|
||||
no_newline,
|
||||
)
|
||||
}
|
||||
Err(err) => {
|
||||
let working_set = StateWorkingSet::new(engine_state);
|
||||
|
Reference in New Issue
Block a user