From 99076af18bec1ac1fb39b7eab9da58f10008929b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Audiger?= <31616285+jaudiger@users.noreply.github.com> Date: Sun, 5 Feb 2023 22:17:46 +0100 Subject: [PATCH] Use imported names in `Command::run` signatures (#7967) # Description _(Thank you for improving Nushell. Please, check our [contributing guide](../CONTRIBUTING.md) and talk to the core team before making major changes.)_ I opened this PR to unify the run command method. It's mainly to improve consistency across the tree. # User-Facing Changes None. # Tests + Formatting Don't forget to add tests that cover your changes. 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 -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # After Submitting If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --- crates/nu-command/src/bits/and.rs | 2 +- crates/nu-command/src/bits/bits_.rs | 4 +- crates/nu-command/src/bits/not.rs | 2 +- crates/nu-command/src/bits/or.rs | 2 +- crates/nu-command/src/bits/rotate_left.rs | 2 +- crates/nu-command/src/bits/rotate_right.rs | 2 +- crates/nu-command/src/bits/shift_left.rs | 2 +- crates/nu-command/src/bits/shift_right.rs | 2 +- crates/nu-command/src/bits/xor.rs | 2 +- crates/nu-command/src/bytes/build_.rs | 2 +- crates/nu-command/src/bytes/bytes_.rs | 4 +- crates/nu-command/src/conversions/fmt.rs | 4 +- .../nu-command/src/conversions/into/binary.rs | 4 +- .../nu-command/src/conversions/into/bool.rs | 2 +- .../src/conversions/into/command.rs | 4 +- .../src/conversions/into/decimal.rs | 2 +- .../src/conversions/into/duration.rs | 2 +- .../src/conversions/into/filesize.rs | 2 +- crates/nu-command/src/conversions/into/int.rs | 2 +- .../nu-command/src/conversions/into/record.rs | 2 +- .../nu-command/src/conversions/into/string.rs | 4 +- crates/nu-command/src/core_commands/alias.rs | 6 +- crates/nu-command/src/core_commands/break_.rs | 2 +- crates/nu-command/src/core_commands/const_.rs | 2 +- .../nu-command/src/core_commands/continue_.rs | 2 +- crates/nu-command/src/core_commands/def.rs | 6 +- .../nu-command/src/core_commands/def_env.rs | 6 +- .../src/core_commands/error_make.rs | 2 +- crates/nu-command/src/core_commands/export.rs | 4 +- .../src/core_commands/export_alias.rs | 4 +- .../src/core_commands/export_def.rs | 6 +- .../src/core_commands/export_def_env.rs | 6 +- .../src/core_commands/export_extern.rs | 4 +- .../src/core_commands/export_use.rs | 6 +- .../nu-command/src/core_commands/extern_.rs | 4 +- crates/nu-command/src/core_commands/for_.rs | 2 +- crates/nu-command/src/core_commands/hide.rs | 4 +- .../nu-command/src/core_commands/hide_env.rs | 2 +- crates/nu-command/src/core_commands/if_.rs | 2 +- crates/nu-command/src/core_commands/ignore.rs | 4 +- crates/nu-command/src/core_commands/let_.rs | 4 +- crates/nu-command/src/core_commands/loop_.rs | 2 +- .../nu-command/src/core_commands/metadata.rs | 6 +- crates/nu-command/src/core_commands/module.rs | 6 +- crates/nu-command/src/core_commands/mut_.rs | 4 +- .../src/core_commands/overlay/command.rs | 6 +- .../src/core_commands/overlay/hide.rs | 2 +- .../nu-command/src/core_commands/register.rs | 4 +- .../nu-command/src/core_commands/return_.rs | 2 +- crates/nu-command/src/core_commands/try_.rs | 5 +- crates/nu-command/src/core_commands/while_.rs | 2 +- crates/nu-command/src/date/format.rs | 2 +- crates/nu-command/src/date/humanize.rs | 2 +- crates/nu-command/src/date/list_timezone.rs | 5 +- crates/nu-command/src/date/now.rs | 6 +- crates/nu-command/src/date/to_record.rs | 4 +- crates/nu-command/src/date/to_table.rs | 4 +- crates/nu-command/src/date/to_timezone.rs | 2 +- .../nu-command/src/deprecated/str_datetime.rs | 4 +- .../nu-command/src/deprecated/str_decimal.rs | 4 +- .../src/deprecated/str_find_replace.rs | 4 +- crates/nu-command/src/deprecated/str_int.rs | 4 +- crates/nu-command/src/env/config/config_.rs | 4 +- .../nu-command/src/env/config/config_env.rs | 2 +- crates/nu-command/src/env/config/config_nu.rs | 2 +- .../nu-command/src/env/config/config_reset.rs | 2 +- crates/nu-command/src/env/env_command.rs | 2 +- crates/nu-command/src/env/export_env.rs | 4 +- crates/nu-command/src/env/let_env.rs | 2 +- crates/nu-command/src/env/load_env.rs | 2 +- crates/nu-command/src/env/with_env.rs | 2 +- .../nu-command/src/experimental/is_admin.rs | 6 +- .../src/experimental/view_source.rs | 2 +- crates/nu-command/src/filesystem/cd.rs | 2 +- crates/nu-command/src/filesystem/ls.rs | 2 +- crates/nu-command/src/filesystem/mv.rs | 2 +- crates/nu-command/src/filesystem/open.rs | 2 +- crates/nu-command/src/filesystem/save.rs | 2 +- crates/nu-command/src/filesystem/start.rs | 2 +- crates/nu-command/src/filesystem/watch.rs | 2 +- crates/nu-command/src/filters/collect.rs | 5 +- crates/nu-command/src/filters/compact.rs | 4 +- crates/nu-command/src/filters/default.rs | 6 +- crates/nu-command/src/filters/each.rs | 2 +- crates/nu-command/src/filters/each_while.rs | 6 +- crates/nu-command/src/filters/empty.rs | 7 +- crates/nu-command/src/filters/enumerate.rs | 5 +- crates/nu-command/src/filters/filter.rs | 6 +- crates/nu-command/src/filters/first.rs | 4 +- crates/nu-command/src/filters/flatten.rs | 4 +- crates/nu-command/src/filters/get.rs | 6 +- crates/nu-command/src/filters/group.rs | 6 +- crates/nu-command/src/filters/group_by.rs | 2 +- crates/nu-command/src/filters/headers.rs | 2 +- crates/nu-command/src/filters/insert.rs | 2 +- crates/nu-command/src/filters/length.rs | 2 +- crates/nu-command/src/filters/lines.rs | 2 +- crates/nu-command/src/filters/merge.rs | 2 +- crates/nu-command/src/filters/move_.rs | 2 +- crates/nu-command/src/filters/par_each.rs | 6 +- crates/nu-command/src/filters/reject.rs | 2 +- crates/nu-command/src/filters/rename.rs | 4 +- .../nu-command/src/filters/roll/roll_down.rs | 2 +- .../nu-command/src/filters/roll/roll_left.rs | 2 +- .../nu-command/src/filters/roll/roll_right.rs | 2 +- crates/nu-command/src/filters/roll/roll_up.rs | 2 +- crates/nu-command/src/filters/select.rs | 2 +- crates/nu-command/src/filters/split_by.rs | 2 +- crates/nu-command/src/filters/take/take_.rs | 2 +- crates/nu-command/src/filters/transpose.rs | 4 +- crates/nu-command/src/filters/uniq.rs | 4 +- crates/nu-command/src/filters/uniq_by.rs | 2 +- crates/nu-command/src/filters/update.rs | 2 +- crates/nu-command/src/filters/upsert.rs | 2 +- crates/nu-command/src/filters/where_.rs | 6 +- crates/nu-command/src/filters/window.rs | 6 +- crates/nu-command/src/filters/wrap.rs | 6 +- crates/nu-command/src/filters/zip.rs | 6 +- crates/nu-command/src/formats/from/command.rs | 2 +- crates/nu-command/src/formats/from/csv.rs | 2 +- crates/nu-command/src/formats/from/eml.rs | 2 +- crates/nu-command/src/formats/from/ics.rs | 2 +- crates/nu-command/src/formats/from/ini.rs | 2 +- crates/nu-command/src/formats/from/json.rs | 2 +- crates/nu-command/src/formats/from/nuon.rs | 2 +- crates/nu-command/src/formats/from/ods.rs | 2 +- crates/nu-command/src/formats/from/ssv.rs | 2 +- crates/nu-command/src/formats/from/toml.rs | 2 +- crates/nu-command/src/formats/from/tsv.rs | 2 +- crates/nu-command/src/formats/from/url.rs | 2 +- crates/nu-command/src/formats/from/vcf.rs | 2 +- crates/nu-command/src/formats/from/xlsx.rs | 2 +- crates/nu-command/src/formats/from/xml.rs | 2 +- crates/nu-command/src/formats/from/yaml.rs | 4 +- crates/nu-command/src/formats/to/command.rs | 2 +- crates/nu-command/src/formats/to/csv.rs | 2 +- crates/nu-command/src/formats/to/html.rs | 2 +- crates/nu-command/src/formats/to/json.rs | 2 +- crates/nu-command/src/formats/to/md.rs | 2 +- crates/nu-command/src/formats/to/nuon.rs | 2 +- crates/nu-command/src/formats/to/text.rs | 2 +- crates/nu-command/src/formats/to/toml.rs | 2 +- crates/nu-command/src/formats/to/xml.rs | 2 +- crates/nu-command/src/formats/to/yaml.rs | 2 +- crates/nu-command/src/generators/cal.rs | 4 +- crates/nu-command/src/generators/seq_char.rs | 2 +- crates/nu-command/src/generators/seq_date.rs | 2 +- crates/nu-command/src/hash/generic_digest.rs | 2 +- crates/nu-command/src/math/abs.rs | 2 +- crates/nu-command/src/math/arccos.rs | 2 +- crates/nu-command/src/math/arccosh.rs | 2 +- crates/nu-command/src/math/arcsin.rs | 2 +- crates/nu-command/src/math/arcsinh.rs | 2 +- crates/nu-command/src/math/arctan.rs | 2 +- crates/nu-command/src/math/arctanh.rs | 2 +- crates/nu-command/src/math/avg.rs | 2 +- crates/nu-command/src/math/ceil.rs | 2 +- crates/nu-command/src/math/cos.rs | 2 +- crates/nu-command/src/math/cosh.rs | 2 +- crates/nu-command/src/math/euler.rs | 6 +- crates/nu-command/src/math/floor.rs | 2 +- crates/nu-command/src/math/ln.rs | 2 +- crates/nu-command/src/math/log.rs | 2 +- crates/nu-command/src/math/math_.rs | 4 +- crates/nu-command/src/math/max.rs | 2 +- crates/nu-command/src/math/median.rs | 2 +- crates/nu-command/src/math/min.rs | 2 +- crates/nu-command/src/math/mode.rs | 2 +- crates/nu-command/src/math/pi.rs | 6 +- crates/nu-command/src/math/product.rs | 2 +- crates/nu-command/src/math/round.rs | 2 +- crates/nu-command/src/math/sin.rs | 2 +- crates/nu-command/src/math/sinh.rs | 2 +- crates/nu-command/src/math/sqrt.rs | 2 +- crates/nu-command/src/math/stddev.rs | 2 +- crates/nu-command/src/math/sum.rs | 2 +- crates/nu-command/src/math/tan.rs | 2 +- crates/nu-command/src/math/tanh.rs | 2 +- crates/nu-command/src/math/tau.rs | 6 +- crates/nu-command/src/math/utils.rs | 2 +- crates/nu-command/src/math/variance.rs | 2 +- crates/nu-command/src/misc/history.rs | 2 +- crates/nu-command/src/misc/history_session.rs | 6 +- crates/nu-command/src/misc/tutor.rs | 2 +- crates/nu-command/src/network/http/get.rs | 4 +- crates/nu-command/src/network/http/http_.rs | 4 +- crates/nu-command/src/network/http/post.rs | 4 +- .../nu-command/src/network/url/build_query.rs | 2 +- crates/nu-command/src/network/url/join.rs | 13 ++-- crates/nu-command/src/network/url/url_.rs | 4 +- crates/nu-command/src/path/basename.rs | 12 ++-- crates/nu-command/src/path/dirname.rs | 12 ++-- crates/nu-command/src/path/exists.rs | 12 ++-- crates/nu-command/src/path/expand.rs | 12 ++-- crates/nu-command/src/path/join.rs | 8 ++- crates/nu-command/src/path/parse.rs | 12 ++-- crates/nu-command/src/path/path_.rs | 6 +- crates/nu-command/src/path/relative_to.rs | 12 ++-- crates/nu-command/src/path/split.rs | 12 ++-- crates/nu-command/src/path/type.rs | 12 ++-- crates/nu-command/src/platform/ansi/ansi_.rs | 11 ++-- .../nu-command/src/platform/ansi/gradient.rs | 2 +- crates/nu-command/src/platform/ansi/link.rs | 4 +- crates/nu-command/src/platform/ansi/strip.rs | 2 +- .../platform/reedline_commands/keybindings.rs | 4 +- .../reedline_commands/keybindings_default.rs | 4 +- .../reedline_commands/keybindings_list.rs | 4 +- crates/nu-command/src/platform/term_size.rs | 6 +- crates/nu-command/src/random/bool.rs | 2 +- crates/nu-command/src/random/chars.rs | 2 +- crates/nu-command/src/random/decimal.rs | 2 +- crates/nu-command/src/random/dice.rs | 2 +- crates/nu-command/src/random/integer.rs | 2 +- crates/nu-command/src/random/random_.rs | 4 +- crates/nu-command/src/random/uuid.rs | 2 +- crates/nu-command/src/strings/char_.rs | 7 +- crates/nu-command/src/strings/split/chars.rs | 4 +- crates/nu-command/src/strings/split/column.rs | 4 +- .../nu-command/src/strings/split/command.rs | 4 +- crates/nu-command/src/strings/split/list.rs | 7 +- crates/nu-command/src/strings/split/row.rs | 4 +- crates/nu-command/src/strings/split/words.rs | 4 +- .../nu-command/src/strings/str_/case/str_.rs | 4 +- .../nu-command/src/strings/str_/trim/trim_.rs | 2 +- crates/nu-command/src/system/benchmark.rs | 5 +- crates/nu-command/src/system/complete.rs | 2 +- crates/nu-command/src/system/exec.rs | 4 +- crates/nu-command/src/system/ps.rs | 2 +- .../nu-command/src/system/registry_query.rs | 4 +- crates/nu-command/src/system/sys.rs | 2 +- crates/nu-command/src/system/which_.rs | 2 +- crates/nu-command/src/viewers/griddle.rs | 2 +- crates/nu-command/src/viewers/table.rs | 2 +- .../nu-command/tests/commands/random/uuid.rs | 2 +- crates/nu-parser/tests/test_parser.rs | 66 ++++++++++--------- src/command.rs | 2 +- 236 files changed, 469 insertions(+), 409 deletions(-) diff --git a/crates/nu-command/src/bits/and.rs b/crates/nu-command/src/bits/and.rs index 7ba4ffebdd..4586c12bf0 100644 --- a/crates/nu-command/src/bits/and.rs +++ b/crates/nu-command/src/bits/and.rs @@ -39,7 +39,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let target: i64 = call.req(engine_state, stack, 0)?; diff --git a/crates/nu-command/src/bits/bits_.rs b/crates/nu-command/src/bits/bits_.rs index 3a3952088b..44f2c15db8 100644 --- a/crates/nu-command/src/bits/bits_.rs +++ b/crates/nu-command/src/bits/bits_.rs @@ -2,7 +2,7 @@ use nu_engine::get_full_help; use nu_protocol::{ ast::Call, engine::{Command, EngineState, Stack}, - Category, IntoPipelineData, PipelineData, Signature, Type, Value, + Category, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value, }; #[derive(Clone)] @@ -33,7 +33,7 @@ impl Command for Bits { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(Value::String { val: get_full_help( &Bits.signature(), diff --git a/crates/nu-command/src/bits/not.rs b/crates/nu-command/src/bits/not.rs index 33ff6e1ddc..3363d7dd7c 100644 --- a/crates/nu-command/src/bits/not.rs +++ b/crates/nu-command/src/bits/not.rs @@ -46,7 +46,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let signed = call.has_flag("signed"); let number_bytes: Option> = diff --git a/crates/nu-command/src/bits/or.rs b/crates/nu-command/src/bits/or.rs index 5009999e4e..4950e737a3 100644 --- a/crates/nu-command/src/bits/or.rs +++ b/crates/nu-command/src/bits/or.rs @@ -39,7 +39,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let target: i64 = call.req(engine_state, stack, 0)?; diff --git a/crates/nu-command/src/bits/rotate_left.rs b/crates/nu-command/src/bits/rotate_left.rs index 146133b4ca..6693248776 100644 --- a/crates/nu-command/src/bits/rotate_left.rs +++ b/crates/nu-command/src/bits/rotate_left.rs @@ -49,7 +49,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let bits: usize = call.req(engine_state, stack, 0)?; let signed = call.has_flag("signed"); diff --git a/crates/nu-command/src/bits/rotate_right.rs b/crates/nu-command/src/bits/rotate_right.rs index d773004734..91841b9880 100644 --- a/crates/nu-command/src/bits/rotate_right.rs +++ b/crates/nu-command/src/bits/rotate_right.rs @@ -49,7 +49,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let bits: usize = call.req(engine_state, stack, 0)?; let signed = call.has_flag("signed"); diff --git a/crates/nu-command/src/bits/shift_left.rs b/crates/nu-command/src/bits/shift_left.rs index ac467e740b..599dd0a4e0 100644 --- a/crates/nu-command/src/bits/shift_left.rs +++ b/crates/nu-command/src/bits/shift_left.rs @@ -49,7 +49,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let bits: usize = call.req(engine_state, stack, 0)?; let signed = call.has_flag("signed"); diff --git a/crates/nu-command/src/bits/shift_right.rs b/crates/nu-command/src/bits/shift_right.rs index e31e53507c..668439220f 100644 --- a/crates/nu-command/src/bits/shift_right.rs +++ b/crates/nu-command/src/bits/shift_right.rs @@ -49,7 +49,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let bits: usize = call.req(engine_state, stack, 0)?; let signed = call.has_flag("signed"); diff --git a/crates/nu-command/src/bits/xor.rs b/crates/nu-command/src/bits/xor.rs index a3ca34b417..289f2484d9 100644 --- a/crates/nu-command/src/bits/xor.rs +++ b/crates/nu-command/src/bits/xor.rs @@ -39,7 +39,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let target: i64 = call.req(engine_state, stack, 0)?; // This doesn't match explicit nulls diff --git a/crates/nu-command/src/bytes/build_.rs b/crates/nu-command/src/bytes/build_.rs index f61916908d..4b607e61d6 100644 --- a/crates/nu-command/src/bytes/build_.rs +++ b/crates/nu-command/src/bytes/build_.rs @@ -46,7 +46,7 @@ impl Command for BytesBuild { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { let mut output = vec![]; for expr in call.positional_iter() { let val = eval_expression(engine_state, stack, expr)?; diff --git a/crates/nu-command/src/bytes/bytes_.rs b/crates/nu-command/src/bytes/bytes_.rs index fb66ab223c..d7366c52e1 100644 --- a/crates/nu-command/src/bytes/bytes_.rs +++ b/crates/nu-command/src/bytes/bytes_.rs @@ -2,7 +2,7 @@ use nu_engine::get_full_help; use nu_protocol::{ ast::Call, engine::{Command, EngineState, Stack}, - Category, IntoPipelineData, PipelineData, Signature, Type, Value, + Category, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value, }; #[derive(Clone)] @@ -33,7 +33,7 @@ impl Command for Bytes { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(Value::String { val: get_full_help( &Bytes.signature(), diff --git a/crates/nu-command/src/conversions/fmt.rs b/crates/nu-command/src/conversions/fmt.rs index ed033a4f21..f41f9cbbb7 100644 --- a/crates/nu-command/src/conversions/fmt.rs +++ b/crates/nu-command/src/conversions/fmt.rs @@ -64,7 +64,7 @@ impl Command for Fmt { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { fmt(engine_state, stack, call, input) } } @@ -74,7 +74,7 @@ fn fmt( stack: &mut Stack, call: &Call, input: PipelineData, -) -> Result { +) -> Result { let cell_paths: Vec = call.rest(engine_state, stack, 0)?; let args = CellPathOnlyArgs::from(cell_paths); operate(action, args, input, call.head, engine_state.ctrlc.clone()) diff --git a/crates/nu-command/src/conversions/into/binary.rs b/crates/nu-command/src/conversions/into/binary.rs index fab732b7cb..f7c3d8f676 100644 --- a/crates/nu-command/src/conversions/into/binary.rs +++ b/crates/nu-command/src/conversions/into/binary.rs @@ -49,7 +49,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { into_binary(engine_state, stack, call, input) } @@ -109,7 +109,7 @@ fn into_binary( stack: &mut Stack, call: &Call, input: PipelineData, -) -> Result { +) -> Result { let head = call.head; let cell_paths: Vec = call.rest(engine_state, stack, 0)?; diff --git a/crates/nu-command/src/conversions/into/bool.rs b/crates/nu-command/src/conversions/into/bool.rs index 4811d50076..787fc2e526 100644 --- a/crates/nu-command/src/conversions/into/bool.rs +++ b/crates/nu-command/src/conversions/into/bool.rs @@ -45,7 +45,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { into_bool(engine_state, stack, call, input) } diff --git a/crates/nu-command/src/conversions/into/command.rs b/crates/nu-command/src/conversions/into/command.rs index 408acbf6ea..97b35fe24f 100644 --- a/crates/nu-command/src/conversions/into/command.rs +++ b/crates/nu-command/src/conversions/into/command.rs @@ -2,7 +2,7 @@ use nu_engine::get_full_help; use nu_protocol::{ ast::Call, engine::{Command, EngineState, Stack}, - Category, IntoPipelineData, PipelineData, Signature, Type, Value, + Category, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value, }; #[derive(Clone)] @@ -33,7 +33,7 @@ impl Command for Into { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(Value::String { val: get_full_help( &Into.signature(), diff --git a/crates/nu-command/src/conversions/into/decimal.rs b/crates/nu-command/src/conversions/into/decimal.rs index 1df8c76e1f..ea78429668 100644 --- a/crates/nu-command/src/conversions/into/decimal.rs +++ b/crates/nu-command/src/conversions/into/decimal.rs @@ -41,7 +41,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let cell_paths: Vec = call.rest(engine_state, stack, 0)?; let args = CellPathOnlyArgs::from(cell_paths); operate(action, args, input, call.head, engine_state.ctrlc.clone()) diff --git a/crates/nu-command/src/conversions/into/duration.rs b/crates/nu-command/src/conversions/into/duration.rs index 30ce744b38..df8b408d25 100644 --- a/crates/nu-command/src/conversions/into/duration.rs +++ b/crates/nu-command/src/conversions/into/duration.rs @@ -56,7 +56,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { into_duration(engine_state, stack, call, input) } diff --git a/crates/nu-command/src/conversions/into/filesize.rs b/crates/nu-command/src/conversions/into/filesize.rs index deb48d32b1..775b84e436 100644 --- a/crates/nu-command/src/conversions/into/filesize.rs +++ b/crates/nu-command/src/conversions/into/filesize.rs @@ -44,7 +44,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let cell_paths: Vec = call.rest(engine_state, stack, 0)?; let args = CellPathOnlyArgs::from(cell_paths); operate(action, args, input, call.head, engine_state.ctrlc.clone()) diff --git a/crates/nu-command/src/conversions/into/int.rs b/crates/nu-command/src/conversions/into/int.rs index 8013e1ed05..b0d935bb42 100644 --- a/crates/nu-command/src/conversions/into/int.rs +++ b/crates/nu-command/src/conversions/into/int.rs @@ -62,7 +62,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let cell_paths = call.rest(engine_state, stack, 0)?; let cell_paths = (!cell_paths.is_empty()).then_some(cell_paths); diff --git a/crates/nu-command/src/conversions/into/record.rs b/crates/nu-command/src/conversions/into/record.rs index 97e7bbd138..462042be00 100644 --- a/crates/nu-command/src/conversions/into/record.rs +++ b/crates/nu-command/src/conversions/into/record.rs @@ -40,7 +40,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { into_record(engine_state, call, input) } diff --git a/crates/nu-command/src/conversions/into/string.rs b/crates/nu-command/src/conversions/into/string.rs index 146f05e273..8c9d5d4f43 100644 --- a/crates/nu-command/src/conversions/into/string.rs +++ b/crates/nu-command/src/conversions/into/string.rs @@ -70,7 +70,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { string_helper(engine_state, stack, call, input) } @@ -148,7 +148,7 @@ fn string_helper( stack: &mut Stack, call: &Call, input: PipelineData, -) -> Result { +) -> Result { let decimals = call.has_flag("decimals"); let head = call.head; let decimals_value: Option = call.get_flag(engine_state, stack, "decimals")?; diff --git a/crates/nu-command/src/core_commands/alias.rs b/crates/nu-command/src/core_commands/alias.rs index e43987263c..2a13b6bff1 100644 --- a/crates/nu-command/src/core_commands/alias.rs +++ b/crates/nu-command/src/core_commands/alias.rs @@ -1,6 +1,8 @@ use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; -use nu_protocol::{Category, Example, PipelineData, Signature, Span, SyntaxShape, Type, Value}; +use nu_protocol::{ + Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value, +}; #[derive(Clone)] pub struct Alias; @@ -45,7 +47,7 @@ impl Command for Alias { _stack: &mut Stack, _call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(PipelineData::empty()) } diff --git a/crates/nu-command/src/core_commands/break_.rs b/crates/nu-command/src/core_commands/break_.rs index 1951466a4c..2fab61682a 100644 --- a/crates/nu-command/src/core_commands/break_.rs +++ b/crates/nu-command/src/core_commands/break_.rs @@ -35,7 +35,7 @@ impl Command for Break { _stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Err(ShellError::Break(call.head)) } diff --git a/crates/nu-command/src/core_commands/const_.rs b/crates/nu-command/src/core_commands/const_.rs index 190f31e731..0da4efcac6 100644 --- a/crates/nu-command/src/core_commands/const_.rs +++ b/crates/nu-command/src/core_commands/const_.rs @@ -46,7 +46,7 @@ impl Command for Const { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { let var_id = call .positional_nth(0) .expect("checked through parser") diff --git a/crates/nu-command/src/core_commands/continue_.rs b/crates/nu-command/src/core_commands/continue_.rs index c16af5ebad..24578526ea 100644 --- a/crates/nu-command/src/core_commands/continue_.rs +++ b/crates/nu-command/src/core_commands/continue_.rs @@ -35,7 +35,7 @@ impl Command for Continue { _stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Err(ShellError::Continue(call.head)) } diff --git a/crates/nu-command/src/core_commands/def.rs b/crates/nu-command/src/core_commands/def.rs index 450403d71b..7dc10ca8b7 100644 --- a/crates/nu-command/src/core_commands/def.rs +++ b/crates/nu-command/src/core_commands/def.rs @@ -1,6 +1,8 @@ use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; -use nu_protocol::{Category, Example, PipelineData, Signature, SyntaxShape, Type, Value}; +use nu_protocol::{ + Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type, Value, +}; #[derive(Clone)] pub struct Def; @@ -38,7 +40,7 @@ impl Command for Def { _stack: &mut Stack, _call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(PipelineData::empty()) } diff --git a/crates/nu-command/src/core_commands/def_env.rs b/crates/nu-command/src/core_commands/def_env.rs index da7ec51102..364742a041 100644 --- a/crates/nu-command/src/core_commands/def_env.rs +++ b/crates/nu-command/src/core_commands/def_env.rs @@ -1,6 +1,8 @@ use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; -use nu_protocol::{Category, Example, PipelineData, Signature, SyntaxShape, Type, Value}; +use nu_protocol::{ + Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type, Value, +}; #[derive(Clone)] pub struct DefEnv; @@ -64,7 +66,7 @@ def-env cd_with_fallback [arg = ""] { _stack: &mut Stack, _call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(PipelineData::empty()) } diff --git a/crates/nu-command/src/core_commands/error_make.rs b/crates/nu-command/src/core_commands/error_make.rs index f2ceac281e..906237cef4 100644 --- a/crates/nu-command/src/core_commands/error_make.rs +++ b/crates/nu-command/src/core_commands/error_make.rs @@ -39,7 +39,7 @@ impl Command for ErrorMake { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { let span = call.head; let arg: Value = call.req(engine_state, stack, 0)?; let unspanned = call.has_flag("unspanned"); diff --git a/crates/nu-command/src/core_commands/export.rs b/crates/nu-command/src/core_commands/export.rs index 656c9081d7..0147bb32c5 100644 --- a/crates/nu-command/src/core_commands/export.rs +++ b/crates/nu-command/src/core_commands/export.rs @@ -2,7 +2,7 @@ use nu_engine::get_full_help; use nu_protocol::{ ast::Call, engine::{Command, EngineState, Stack}, - Category, Example, IntoPipelineData, PipelineData, Signature, Type, Value, + Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value, }; #[derive(Clone)] @@ -38,7 +38,7 @@ impl Command for ExportCommand { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(Value::String { val: get_full_help( &ExportCommand.signature(), diff --git a/crates/nu-command/src/core_commands/export_alias.rs b/crates/nu-command/src/core_commands/export_alias.rs index 2529b309b6..e3dac70299 100644 --- a/crates/nu-command/src/core_commands/export_alias.rs +++ b/crates/nu-command/src/core_commands/export_alias.rs @@ -1,6 +1,6 @@ use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; -use nu_protocol::{Category, Example, PipelineData, Signature, SyntaxShape, Type}; +use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type}; #[derive(Clone)] pub struct ExportAlias; @@ -41,7 +41,7 @@ impl Command for ExportAlias { _stack: &mut Stack, _call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(PipelineData::empty()) } diff --git a/crates/nu-command/src/core_commands/export_def.rs b/crates/nu-command/src/core_commands/export_def.rs index e56cf3bf4d..f4d1251f07 100644 --- a/crates/nu-command/src/core_commands/export_def.rs +++ b/crates/nu-command/src/core_commands/export_def.rs @@ -1,6 +1,8 @@ use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; -use nu_protocol::{Category, Example, PipelineData, Signature, SyntaxShape, Type, Value}; +use nu_protocol::{ + Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type, Value, +}; #[derive(Clone)] pub struct ExportDef; @@ -38,7 +40,7 @@ impl Command for ExportDef { _stack: &mut Stack, _call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(PipelineData::empty()) } diff --git a/crates/nu-command/src/core_commands/export_def_env.rs b/crates/nu-command/src/core_commands/export_def_env.rs index 324458a29f..48e650b643 100644 --- a/crates/nu-command/src/core_commands/export_def_env.rs +++ b/crates/nu-command/src/core_commands/export_def_env.rs @@ -1,6 +1,8 @@ use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; -use nu_protocol::{Category, Example, PipelineData, Signature, SyntaxShape, Type, Value}; +use nu_protocol::{ + Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type, Value, +}; #[derive(Clone)] pub struct ExportDefEnv; @@ -64,7 +66,7 @@ export def-env cd_with_fallback [arg = ""] { _stack: &mut Stack, _call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(PipelineData::empty()) } diff --git a/crates/nu-command/src/core_commands/export_extern.rs b/crates/nu-command/src/core_commands/export_extern.rs index b53daf0a98..186c722af3 100644 --- a/crates/nu-command/src/core_commands/export_extern.rs +++ b/crates/nu-command/src/core_commands/export_extern.rs @@ -1,6 +1,6 @@ use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; -use nu_protocol::{Category, Example, PipelineData, Signature, SyntaxShape, Type}; +use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type}; #[derive(Clone)] pub struct ExportExtern; @@ -37,7 +37,7 @@ impl Command for ExportExtern { _stack: &mut Stack, _call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(PipelineData::empty()) } diff --git a/crates/nu-command/src/core_commands/export_use.rs b/crates/nu-command/src/core_commands/export_use.rs index 56e7ca1299..4d2b5638e0 100644 --- a/crates/nu-command/src/core_commands/export_use.rs +++ b/crates/nu-command/src/core_commands/export_use.rs @@ -1,6 +1,8 @@ use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; -use nu_protocol::{Category, Example, PipelineData, Signature, SyntaxShape, Type, Value}; +use nu_protocol::{ + Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type, Value, +}; #[derive(Clone)] pub struct ExportUse; @@ -41,7 +43,7 @@ impl Command for ExportUse { _stack: &mut Stack, _call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(PipelineData::empty()) } diff --git a/crates/nu-command/src/core_commands/extern_.rs b/crates/nu-command/src/core_commands/extern_.rs index d421d1ef16..1b35bb23f8 100644 --- a/crates/nu-command/src/core_commands/extern_.rs +++ b/crates/nu-command/src/core_commands/extern_.rs @@ -1,6 +1,6 @@ use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; -use nu_protocol::{Category, Example, PipelineData, Signature, SyntaxShape, Type}; +use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type}; #[derive(Clone)] pub struct Extern; @@ -37,7 +37,7 @@ impl Command for Extern { _stack: &mut Stack, _call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(PipelineData::empty()) } diff --git a/crates/nu-command/src/core_commands/for_.rs b/crates/nu-command/src/core_commands/for_.rs index e8c82627eb..ee7d45bd34 100644 --- a/crates/nu-command/src/core_commands/for_.rs +++ b/crates/nu-command/src/core_commands/for_.rs @@ -56,7 +56,7 @@ impl Command for For { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let var_id = call .positional_nth(0) diff --git a/crates/nu-command/src/core_commands/hide.rs b/crates/nu-command/src/core_commands/hide.rs index 185c93368e..80966a9ca7 100644 --- a/crates/nu-command/src/core_commands/hide.rs +++ b/crates/nu-command/src/core_commands/hide.rs @@ -1,6 +1,6 @@ use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; -use nu_protocol::{Category, Example, PipelineData, Signature, SyntaxShape, Type}; +use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type}; #[derive(Clone)] pub struct Hide; @@ -43,7 +43,7 @@ This command is a parser keyword. For details, check: _stack: &mut Stack, _call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(PipelineData::empty()) } diff --git a/crates/nu-command/src/core_commands/hide_env.rs b/crates/nu-command/src/core_commands/hide_env.rs index 369877d4f6..4a060706d1 100644 --- a/crates/nu-command/src/core_commands/hide_env.rs +++ b/crates/nu-command/src/core_commands/hide_env.rs @@ -40,7 +40,7 @@ impl Command for HideEnv { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { let env_var_names: Vec> = call.rest(engine_state, stack, 0)?; let ignore_errors = call.has_flag("ignore-errors"); diff --git a/crates/nu-command/src/core_commands/if_.rs b/crates/nu-command/src/core_commands/if_.rs index 160e7a82fb..cf89e54222 100644 --- a/crates/nu-command/src/core_commands/if_.rs +++ b/crates/nu-command/src/core_commands/if_.rs @@ -55,7 +55,7 @@ impl Command for If { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let cond = call.positional_nth(0).expect("checked through parser"); let then_block: Block = call.req(engine_state, stack, 1)?; let else_case = call.positional_nth(2); diff --git a/crates/nu-command/src/core_commands/ignore.rs b/crates/nu-command/src/core_commands/ignore.rs index 4f374cec12..5695029515 100644 --- a/crates/nu-command/src/core_commands/ignore.rs +++ b/crates/nu-command/src/core_commands/ignore.rs @@ -1,6 +1,6 @@ use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; -use nu_protocol::{Category, Example, PipelineData, Signature, Span, Type, Value}; +use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Span, Type, Value}; #[derive(Clone)] pub struct Ignore; @@ -30,7 +30,7 @@ impl Command for Ignore { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { input.into_value(call.head); Ok(PipelineData::empty()) } diff --git a/crates/nu-command/src/core_commands/let_.rs b/crates/nu-command/src/core_commands/let_.rs index 4818ac70ab..090893854f 100644 --- a/crates/nu-command/src/core_commands/let_.rs +++ b/crates/nu-command/src/core_commands/let_.rs @@ -1,7 +1,7 @@ use nu_engine::eval_expression_with_input; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; -use nu_protocol::{Category, Example, PipelineData, Signature, SyntaxShape, Type}; +use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type}; #[derive(Clone)] pub struct Let; @@ -47,7 +47,7 @@ impl Command for Let { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let var_id = call .positional_nth(0) .expect("checked through parser") diff --git a/crates/nu-command/src/core_commands/loop_.rs b/crates/nu-command/src/core_commands/loop_.rs index 7c3878f7d1..6aa2c3fc1d 100644 --- a/crates/nu-command/src/core_commands/loop_.rs +++ b/crates/nu-command/src/core_commands/loop_.rs @@ -40,7 +40,7 @@ impl Command for Loop { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { let block: Block = call.req(engine_state, stack, 0)?; loop { diff --git a/crates/nu-command/src/core_commands/metadata.rs b/crates/nu-command/src/core_commands/metadata.rs index 5e716af5aa..3f60b15cd9 100644 --- a/crates/nu-command/src/core_commands/metadata.rs +++ b/crates/nu-command/src/core_commands/metadata.rs @@ -2,8 +2,8 @@ use nu_engine::CallExt; use nu_protocol::ast::{Call, Expr, Expression}; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ - Category, DataSource, Example, IntoPipelineData, PipelineData, PipelineMetadata, Signature, - Span, SyntaxShape, Type, Value, + Category, DataSource, Example, IntoPipelineData, PipelineData, PipelineMetadata, ShellError, + Signature, Span, SyntaxShape, Type, Value, }; #[derive(Clone)] @@ -36,7 +36,7 @@ impl Command for Metadata { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let arg = call.positional_nth(0); let head = call.head; diff --git a/crates/nu-command/src/core_commands/module.rs b/crates/nu-command/src/core_commands/module.rs index bf995b772f..3e11eab969 100644 --- a/crates/nu-command/src/core_commands/module.rs +++ b/crates/nu-command/src/core_commands/module.rs @@ -1,6 +1,8 @@ use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; -use nu_protocol::{Category, Example, PipelineData, Signature, SyntaxShape, Type, Value}; +use nu_protocol::{ + Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type, Value, +}; #[derive(Clone)] pub struct Module; @@ -37,7 +39,7 @@ impl Command for Module { _stack: &mut Stack, _call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(PipelineData::empty()) } diff --git a/crates/nu-command/src/core_commands/mut_.rs b/crates/nu-command/src/core_commands/mut_.rs index ef98bfa118..d974dbc5c7 100644 --- a/crates/nu-command/src/core_commands/mut_.rs +++ b/crates/nu-command/src/core_commands/mut_.rs @@ -1,7 +1,7 @@ use nu_engine::eval_expression_with_input; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; -use nu_protocol::{Category, Example, PipelineData, Signature, SyntaxShape, Type}; +use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type}; #[derive(Clone)] pub struct Mut; @@ -47,7 +47,7 @@ impl Command for Mut { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let var_id = call .positional_nth(0) .expect("checked through parser") diff --git a/crates/nu-command/src/core_commands/overlay/command.rs b/crates/nu-command/src/core_commands/overlay/command.rs index d48ae5811f..8459e7feec 100644 --- a/crates/nu-command/src/core_commands/overlay/command.rs +++ b/crates/nu-command/src/core_commands/overlay/command.rs @@ -2,7 +2,7 @@ use nu_engine::get_full_help; use nu_protocol::{ ast::Call, engine::{Command, EngineState, Stack}, - Category, IntoPipelineData, PipelineData, Signature, Type, Value, + Category, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value, }; #[derive(Clone)] @@ -26,7 +26,7 @@ impl Command for Overlay { fn extra_usage(&self) -> &str { r#"This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html - + You must use one of the following subcommands. Using this command as-is will only produce this help message."# } @@ -40,7 +40,7 @@ impl Command for Overlay { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(Value::String { val: get_full_help( &Overlay.signature(), diff --git a/crates/nu-command/src/core_commands/overlay/hide.rs b/crates/nu-command/src/core_commands/overlay/hide.rs index 9a443ef1a4..d4f970bfd4 100644 --- a/crates/nu-command/src/core_commands/overlay/hide.rs +++ b/crates/nu-command/src/core_commands/overlay/hide.rs @@ -50,7 +50,7 @@ impl Command for OverlayHide { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { let overlay_name: Spanned = if let Some(name) = call.opt(engine_state, stack, 0)? { name } else { diff --git a/crates/nu-command/src/core_commands/register.rs b/crates/nu-command/src/core_commands/register.rs index 730dddd44c..77d4e576ba 100644 --- a/crates/nu-command/src/core_commands/register.rs +++ b/crates/nu-command/src/core_commands/register.rs @@ -1,6 +1,6 @@ use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; -use nu_protocol::{Category, Example, PipelineData, Signature, SyntaxShape, Type}; +use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type}; #[derive(Clone)] pub struct Register; @@ -51,7 +51,7 @@ impl Command for Register { _stack: &mut Stack, _call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(PipelineData::empty()) } diff --git a/crates/nu-command/src/core_commands/return_.rs b/crates/nu-command/src/core_commands/return_.rs index fe4be0623f..2277a6a6a9 100644 --- a/crates/nu-command/src/core_commands/return_.rs +++ b/crates/nu-command/src/core_commands/return_.rs @@ -39,7 +39,7 @@ impl Command for Return { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { let return_value: Option = call.opt(engine_state, stack, 0)?; if let Some(value) = return_value { Err(ShellError::Return(call.head, Box::new(value))) diff --git a/crates/nu-command/src/core_commands/try_.rs b/crates/nu-command/src/core_commands/try_.rs index 95b4d5b1a7..4b5dbfdff0 100644 --- a/crates/nu-command/src/core_commands/try_.rs +++ b/crates/nu-command/src/core_commands/try_.rs @@ -2,7 +2,8 @@ use nu_engine::{eval_block, CallExt}; use nu_protocol::ast::Call; use nu_protocol::engine::{Block, Closure, Command, EngineState, Stack}; use nu_protocol::{ - Category, Example, IntoPipelineData, PipelineData, Signature, SyntaxShape, Type, Value, + Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, SyntaxShape, Type, + Value, }; #[derive(Clone)] @@ -47,7 +48,7 @@ impl Command for Try { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let try_block: Block = call.req(engine_state, stack, 0)?; let catch_block: Option = call.opt(engine_state, stack, 1)?; diff --git a/crates/nu-command/src/core_commands/while_.rs b/crates/nu-command/src/core_commands/while_.rs index 3d99314382..afecf36e0c 100644 --- a/crates/nu-command/src/core_commands/while_.rs +++ b/crates/nu-command/src/core_commands/while_.rs @@ -45,7 +45,7 @@ impl Command for While { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { let cond = call.positional_nth(0).expect("checked through parser"); let block: Block = call.req(engine_state, stack, 1)?; diff --git a/crates/nu-command/src/date/format.rs b/crates/nu-command/src/date/format.rs index 9863baf9da..50d108709a 100644 --- a/crates/nu-command/src/date/format.rs +++ b/crates/nu-command/src/date/format.rs @@ -50,7 +50,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; if call.has_flag("list") { return Ok(PipelineData::Value( diff --git a/crates/nu-command/src/date/humanize.rs b/crates/nu-command/src/date/humanize.rs index 6731dbbe6e..4e365c504e 100644 --- a/crates/nu-command/src/date/humanize.rs +++ b/crates/nu-command/src/date/humanize.rs @@ -45,7 +45,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; // This doesn't match explicit nulls if matches!(input, PipelineData::Empty) { diff --git a/crates/nu-command/src/date/list_timezone.rs b/crates/nu-command/src/date/list_timezone.rs index a9791aa04d..403902537e 100644 --- a/crates/nu-command/src/date/list_timezone.rs +++ b/crates/nu-command/src/date/list_timezone.rs @@ -2,7 +2,8 @@ use chrono_tz::TZ_VARIANTS; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ - Category, Example, IntoInterruptiblePipelineData, PipelineData, Signature, Span, Type, Value, + Category, Example, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature, Span, + Type, Value, }; #[derive(Clone)] @@ -33,7 +34,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { let span = call.head; Ok(TZ_VARIANTS diff --git a/crates/nu-command/src/date/now.rs b/crates/nu-command/src/date/now.rs index 7dd6a8be35..6126415cd2 100644 --- a/crates/nu-command/src/date/now.rs +++ b/crates/nu-command/src/date/now.rs @@ -1,7 +1,9 @@ use chrono::Local; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; -use nu_protocol::{Category, Example, IntoPipelineData, PipelineData, Signature, Type, Value}; +use nu_protocol::{ + Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value, +}; #[derive(Clone)] pub struct SubCommand; @@ -30,7 +32,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let dt = Local::now(); Ok(Value::Date { diff --git a/crates/nu-command/src/date/to_record.rs b/crates/nu-command/src/date/to_record.rs index 57ab32b3e8..3189c9eb04 100644 --- a/crates/nu-command/src/date/to_record.rs +++ b/crates/nu-command/src/date/to_record.rs @@ -2,11 +2,11 @@ use crate::date::utils::parse_date_from_string; use chrono::{DateTime, Datelike, FixedOffset, Local, Timelike}; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; -use nu_protocol::Type; use nu_protocol::{ Category, Example, PipelineData, ShellError::DatetimeParseError, ShellError::PipelineEmpty, Signature, Span, Value, }; +use nu_protocol::{ShellError, Type}; #[derive(Clone)] pub struct SubCommand; @@ -40,7 +40,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; // This doesn't match explicit nulls if matches!(input, PipelineData::Empty) { diff --git a/crates/nu-command/src/date/to_table.rs b/crates/nu-command/src/date/to_table.rs index 68f856bae3..e8d340be85 100644 --- a/crates/nu-command/src/date/to_table.rs +++ b/crates/nu-command/src/date/to_table.rs @@ -2,11 +2,11 @@ use crate::date::utils::parse_date_from_string; use chrono::{DateTime, Datelike, FixedOffset, Local, Timelike}; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; -use nu_protocol::Type; use nu_protocol::{ Category, Example, PipelineData, ShellError::DatetimeParseError, ShellError::PipelineEmpty, Signature, Span, Value, }; +use nu_protocol::{ShellError, Type}; #[derive(Clone)] pub struct SubCommand; @@ -40,7 +40,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; // This doesn't match explicit nulls if matches!(input, PipelineData::Empty) { diff --git a/crates/nu-command/src/date/to_timezone.rs b/crates/nu-command/src/date/to_timezone.rs index 68af189c9e..fc8e50807e 100644 --- a/crates/nu-command/src/date/to_timezone.rs +++ b/crates/nu-command/src/date/to_timezone.rs @@ -52,7 +52,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let timezone: Spanned = call.req(engine_state, stack, 0)?; diff --git a/crates/nu-command/src/deprecated/str_datetime.rs b/crates/nu-command/src/deprecated/str_datetime.rs index 1faa2b5bf6..45cfb85f83 100644 --- a/crates/nu-command/src/deprecated/str_datetime.rs +++ b/crates/nu-command/src/deprecated/str_datetime.rs @@ -1,7 +1,7 @@ use nu_protocol::{ ast::Call, engine::{Command, EngineState, Stack}, - Category, PipelineData, Signature, + Category, PipelineData, ShellError, Signature, }; #[derive(Clone)] @@ -26,7 +26,7 @@ impl Command for StrDatetimeDeprecated { _stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Err(nu_protocol::ShellError::DeprecatedCommand( self.name().to_string(), "into datetime".to_string(), diff --git a/crates/nu-command/src/deprecated/str_decimal.rs b/crates/nu-command/src/deprecated/str_decimal.rs index 25e24be95e..e1be327166 100644 --- a/crates/nu-command/src/deprecated/str_decimal.rs +++ b/crates/nu-command/src/deprecated/str_decimal.rs @@ -1,7 +1,7 @@ use nu_protocol::{ ast::Call, engine::{Command, EngineState, Stack}, - Category, PipelineData, Signature, + Category, PipelineData, ShellError, Signature, }; #[derive(Clone)] @@ -26,7 +26,7 @@ impl Command for StrDecimalDeprecated { _stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Err(nu_protocol::ShellError::DeprecatedCommand( self.name().to_string(), "into decimal".to_string(), diff --git a/crates/nu-command/src/deprecated/str_find_replace.rs b/crates/nu-command/src/deprecated/str_find_replace.rs index 4bbeb98e69..c86bc065e9 100644 --- a/crates/nu-command/src/deprecated/str_find_replace.rs +++ b/crates/nu-command/src/deprecated/str_find_replace.rs @@ -1,7 +1,7 @@ use nu_protocol::{ ast::Call, engine::{Command, EngineState, Stack}, - Category, PipelineData, Signature, + Category, PipelineData, ShellError, Signature, }; #[derive(Clone)] @@ -26,7 +26,7 @@ impl Command for StrFindReplaceDeprecated { _stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Err(nu_protocol::ShellError::DeprecatedCommand( self.name().to_string(), "str replace".to_string(), diff --git a/crates/nu-command/src/deprecated/str_int.rs b/crates/nu-command/src/deprecated/str_int.rs index 2c4e68b08e..853fa48652 100644 --- a/crates/nu-command/src/deprecated/str_int.rs +++ b/crates/nu-command/src/deprecated/str_int.rs @@ -1,7 +1,7 @@ use nu_protocol::{ ast::Call, engine::{Command, EngineState, Stack}, - Category, PipelineData, Signature, + Category, PipelineData, ShellError, Signature, }; #[derive(Clone)] @@ -26,7 +26,7 @@ impl Command for StrIntDeprecated { _stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Err(nu_protocol::ShellError::DeprecatedCommand( self.name().to_string(), "into int".to_string(), diff --git a/crates/nu-command/src/env/config/config_.rs b/crates/nu-command/src/env/config/config_.rs index 0340cefc43..e9ea554f0d 100644 --- a/crates/nu-command/src/env/config/config_.rs +++ b/crates/nu-command/src/env/config/config_.rs @@ -2,7 +2,7 @@ use nu_engine::get_full_help; use nu_protocol::{ ast::Call, engine::{Command, EngineState, Stack}, - Category, IntoPipelineData, PipelineData, Signature, Type, Value, + Category, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value, }; #[derive(Clone)] @@ -33,7 +33,7 @@ impl Command for ConfigMeta { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(Value::String { val: get_full_help( &ConfigMeta.signature(), diff --git a/crates/nu-command/src/env/config/config_env.rs b/crates/nu-command/src/env/config/config_env.rs index d3854f1efb..9cdca8e46a 100644 --- a/crates/nu-command/src/env/config/config_env.rs +++ b/crates/nu-command/src/env/config/config_env.rs @@ -42,7 +42,7 @@ impl Command for ConfigEnv { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let env_vars_str = env_to_strings(engine_state, stack)?; let mut config_path = match nu_path::config_dir() { Some(path) => path, diff --git a/crates/nu-command/src/env/config/config_nu.rs b/crates/nu-command/src/env/config/config_nu.rs index fdd4e1e317..5f6c5193b6 100644 --- a/crates/nu-command/src/env/config/config_nu.rs +++ b/crates/nu-command/src/env/config/config_nu.rs @@ -42,7 +42,7 @@ impl Command for ConfigNu { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let env_vars_str = env_to_strings(engine_state, stack)?; let mut config_path = match nu_path::config_dir() { Some(path) => path, diff --git a/crates/nu-command/src/env/config/config_reset.rs b/crates/nu-command/src/env/config/config_reset.rs index c0bbb41314..f8b9e925fc 100644 --- a/crates/nu-command/src/env/config/config_reset.rs +++ b/crates/nu-command/src/env/config/config_reset.rs @@ -43,7 +43,7 @@ impl Command for ConfigReset { _stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { let only_nu = call.has_flag("nu"); let only_env = call.has_flag("env"); let no_backup = call.has_flag("without-backup"); diff --git a/crates/nu-command/src/env/env_command.rs b/crates/nu-command/src/env/env_command.rs index 3f7d4dd3f6..a2c1e26c44 100644 --- a/crates/nu-command/src/env/env_command.rs +++ b/crates/nu-command/src/env/env_command.rs @@ -29,7 +29,7 @@ impl Command for Env { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { let span = call.head; let mut env_vars: Vec<(String, Value)> = diff --git a/crates/nu-command/src/env/export_env.rs b/crates/nu-command/src/env/export_env.rs index cde0f98144..bda426ddbd 100644 --- a/crates/nu-command/src/env/export_env.rs +++ b/crates/nu-command/src/env/export_env.rs @@ -2,7 +2,7 @@ use nu_engine::{eval_block, redirect_env, CallExt}; use nu_protocol::{ ast::Call, engine::{Closure, Command, EngineState, Stack}, - Category, Example, PipelineData, Signature, Span, SyntaxShape, Type, Value, + Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value, }; #[derive(Clone)] @@ -34,7 +34,7 @@ impl Command for ExportEnv { caller_stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let capture_block: Closure = call.req(engine_state, caller_stack, 0)?; let block = engine_state.get_block(capture_block.block_id); let mut callee_stack = caller_stack.captures_to_stack(&capture_block.captures); diff --git a/crates/nu-command/src/env/let_env.rs b/crates/nu-command/src/env/let_env.rs index a333182a9f..e3ee9ae32c 100644 --- a/crates/nu-command/src/env/let_env.rs +++ b/crates/nu-command/src/env/let_env.rs @@ -36,7 +36,7 @@ impl Command for LetEnv { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { // TODO: find and require the crossplatform restrictions on environment names let env_var: Spanned = call.req(engine_state, stack, 0)?; diff --git a/crates/nu-command/src/env/load_env.rs b/crates/nu-command/src/env/load_env.rs index 9f08396bbb..9c9dff82a8 100644 --- a/crates/nu-command/src/env/load_env.rs +++ b/crates/nu-command/src/env/load_env.rs @@ -35,7 +35,7 @@ impl Command for LoadEnv { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let arg: Option<(Vec, Vec)> = call.opt(engine_state, stack, 0)?; let span = call.head; diff --git a/crates/nu-command/src/env/with_env.rs b/crates/nu-command/src/env/with_env.rs index 08e38fdb48..658a3ad9cc 100644 --- a/crates/nu-command/src/env/with_env.rs +++ b/crates/nu-command/src/env/with_env.rs @@ -41,7 +41,7 @@ impl Command for WithEnv { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { with_env(engine_state, stack, call, input) } diff --git a/crates/nu-command/src/experimental/is_admin.rs b/crates/nu-command/src/experimental/is_admin.rs index 88d194b33a..15b0d1f0f8 100644 --- a/crates/nu-command/src/experimental/is_admin.rs +++ b/crates/nu-command/src/experimental/is_admin.rs @@ -1,7 +1,9 @@ use is_root::is_root; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; -use nu_protocol::{Category, Example, IntoPipelineData, PipelineData, Signature, Type, Value}; +use nu_protocol::{ + Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value, +}; #[derive(Clone)] pub struct IsAdmin; @@ -32,7 +34,7 @@ impl Command for IsAdmin { _stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(Value::boolean(is_root(), call.head).into_pipeline_data()) } diff --git a/crates/nu-command/src/experimental/view_source.rs b/crates/nu-command/src/experimental/view_source.rs index 9780589d1c..bb7167d149 100644 --- a/crates/nu-command/src/experimental/view_source.rs +++ b/crates/nu-command/src/experimental/view_source.rs @@ -32,7 +32,7 @@ impl Command for ViewSource { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { let arg: Value = call.req(engine_state, stack, 0)?; let arg_span = arg.span()?; diff --git a/crates/nu-command/src/filesystem/cd.rs b/crates/nu-command/src/filesystem/cd.rs index 92fc2209a1..c0e7dc8741 100644 --- a/crates/nu-command/src/filesystem/cd.rs +++ b/crates/nu-command/src/filesystem/cd.rs @@ -60,7 +60,7 @@ impl Command for Cd { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { let path_val: Option> = call.opt(engine_state, stack, 0)?; let cwd = current_dir(engine_state, stack)?; let config = engine_state.get_config(); diff --git a/crates/nu-command/src/filesystem/ls.rs b/crates/nu-command/src/filesystem/ls.rs index a746091138..a94ef6c615 100644 --- a/crates/nu-command/src/filesystem/ls.rs +++ b/crates/nu-command/src/filesystem/ls.rs @@ -72,7 +72,7 @@ impl Command for Ls { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { let all = call.has_flag("all"); let long = call.has_flag("long"); let short_names = call.has_flag("short-names"); diff --git a/crates/nu-command/src/filesystem/mv.rs b/crates/nu-command/src/filesystem/mv.rs index e0bf407473..6f37298e39 100644 --- a/crates/nu-command/src/filesystem/mv.rs +++ b/crates/nu-command/src/filesystem/mv.rs @@ -62,7 +62,7 @@ impl Command for Mv { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { // TODO: handle invalid directory or insufficient permissions when moving let spanned_source: Spanned = call.req(engine_state, stack, 0)?; let spanned_source = { diff --git a/crates/nu-command/src/filesystem/open.rs b/crates/nu-command/src/filesystem/open.rs index 9c230cdb44..04e0571986 100644 --- a/crates/nu-command/src/filesystem/open.rs +++ b/crates/nu-command/src/filesystem/open.rs @@ -48,7 +48,7 @@ impl Command for Open { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let raw = call.has_flag("raw"); let call_span = call.head; let ctrlc = engine_state.ctrlc.clone(); diff --git a/crates/nu-command/src/filesystem/save.rs b/crates/nu-command/src/filesystem/save.rs index 46fed55f00..7692765d7d 100644 --- a/crates/nu-command/src/filesystem/save.rs +++ b/crates/nu-command/src/filesystem/save.rs @@ -60,7 +60,7 @@ impl Command for Save { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let raw = call.has_flag("raw"); let append = call.has_flag("append"); let force = call.has_flag("force"); diff --git a/crates/nu-command/src/filesystem/start.rs b/crates/nu-command/src/filesystem/start.rs index 057b31ba3e..7160a64596 100644 --- a/crates/nu-command/src/filesystem/start.rs +++ b/crates/nu-command/src/filesystem/start.rs @@ -35,7 +35,7 @@ impl Command for Start { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let path = call.opt::>(engine_state, stack, 0)?; let path = { diff --git a/crates/nu-command/src/filesystem/watch.rs b/crates/nu-command/src/filesystem/watch.rs index ed9edffa0f..3715ceef4b 100644 --- a/crates/nu-command/src/filesystem/watch.rs +++ b/crates/nu-command/src/filesystem/watch.rs @@ -66,7 +66,7 @@ impl Command for Watch { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { let cwd = current_dir(engine_state, stack)?; let path_arg: Spanned = call.req(engine_state, stack, 0)?; diff --git a/crates/nu-command/src/filters/collect.rs b/crates/nu-command/src/filters/collect.rs index fdb5c05ec6..bef61981b4 100644 --- a/crates/nu-command/src/filters/collect.rs +++ b/crates/nu-command/src/filters/collect.rs @@ -2,7 +2,8 @@ use nu_engine::{eval_block, redirect_env, CallExt}; use nu_protocol::ast::Call; use nu_protocol::engine::{Closure, Command, EngineState, Stack}; use nu_protocol::{ - Category, Example, IntoPipelineData, PipelineData, Signature, SyntaxShape, Type, Value, + Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, SyntaxShape, Type, + Value, }; #[derive(Clone)] @@ -39,7 +40,7 @@ impl Command for Collect { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let capture_block: Closure = call.req(engine_state, stack, 0)?; let block = engine_state.get_block(capture_block.block_id).clone(); diff --git a/crates/nu-command/src/filters/compact.rs b/crates/nu-command/src/filters/compact.rs index 979c418797..69aea42593 100644 --- a/crates/nu-command/src/filters/compact.rs +++ b/crates/nu-command/src/filters/compact.rs @@ -45,7 +45,7 @@ impl Command for Compact { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { compact(engine_state, stack, call, input) } @@ -88,7 +88,7 @@ pub fn compact( stack: &mut Stack, call: &Call, input: PipelineData, -) -> Result { +) -> Result { let columns: Vec = call.rest(engine_state, stack, 0)?; let metadata = input.metadata(); input diff --git a/crates/nu-command/src/filters/default.rs b/crates/nu-command/src/filters/default.rs index 1d24f88157..e16c97a5a5 100644 --- a/crates/nu-command/src/filters/default.rs +++ b/crates/nu-command/src/filters/default.rs @@ -2,7 +2,7 @@ use nu_engine::CallExt; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ - Category, Example, PipelineData, Signature, Span, Spanned, SyntaxShape, Type, Value, + Category, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Type, Value, }; #[derive(Clone)] @@ -37,7 +37,7 @@ impl Command for Default { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { default(engine_state, stack, call, input) } @@ -76,7 +76,7 @@ fn default( stack: &mut Stack, call: &Call, input: PipelineData, -) -> Result { +) -> Result { let value: Value = call.req(engine_state, stack, 0)?; let column: Option> = call.opt(engine_state, stack, 1)?; diff --git a/crates/nu-command/src/filters/each.rs b/crates/nu-command/src/filters/each.rs index d1e5ea2ef1..500ad4728f 100644 --- a/crates/nu-command/src/filters/each.rs +++ b/crates/nu-command/src/filters/each.rs @@ -119,7 +119,7 @@ with 'transpose' first."# stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let capture_block: Closure = call.req(engine_state, stack, 0)?; let keep_empty = call.has_flag("keep-empty"); diff --git a/crates/nu-command/src/filters/each_while.rs b/crates/nu-command/src/filters/each_while.rs index fa64d8c4b7..2da08aa0a4 100644 --- a/crates/nu-command/src/filters/each_while.rs +++ b/crates/nu-command/src/filters/each_while.rs @@ -2,8 +2,8 @@ use nu_engine::{eval_block_with_early_return, CallExt}; use nu_protocol::ast::Call; use nu_protocol::engine::{Closure, Command, EngineState, Stack}; use nu_protocol::{ - Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, Signature, - Span, SyntaxShape, Type, Value, + Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, ShellError, + Signature, Span, SyntaxShape, Type, Value, }; #[derive(Clone)] @@ -80,7 +80,7 @@ impl Command for EachWhile { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let capture_block: Closure = call.req(engine_state, stack, 0)?; let metadata = input.metadata(); diff --git a/crates/nu-command/src/filters/empty.rs b/crates/nu-command/src/filters/empty.rs index 7500993986..ca02f40408 100644 --- a/crates/nu-command/src/filters/empty.rs +++ b/crates/nu-command/src/filters/empty.rs @@ -2,7 +2,8 @@ use nu_engine::CallExt; use nu_protocol::ast::{Call, CellPath}; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ - Category, Example, IntoPipelineData, PipelineData, Signature, SyntaxShape, Type, Value, + Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, SyntaxShape, Type, + Value, }; #[derive(Clone)] @@ -34,7 +35,7 @@ impl Command for Empty { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { empty(engine_state, stack, call, input) } @@ -65,7 +66,7 @@ fn empty( stack: &mut Stack, call: &Call, input: PipelineData, -) -> Result { +) -> Result { let head = call.head; let columns: Vec = call.rest(engine_state, stack, 0)?; diff --git a/crates/nu-command/src/filters/enumerate.rs b/crates/nu-command/src/filters/enumerate.rs index d029ae3013..ee94efa7be 100644 --- a/crates/nu-command/src/filters/enumerate.rs +++ b/crates/nu-command/src/filters/enumerate.rs @@ -1,7 +1,8 @@ use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ - Category, Example, IntoInterruptiblePipelineData, PipelineData, Signature, Span, Type, Value, + Category, Example, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature, Span, + Type, Value, }; #[derive(Clone)] @@ -59,7 +60,7 @@ impl Command for Enumerate { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let metadata = input.metadata(); let ctrlc = engine_state.ctrlc.clone(); let span = call.head; diff --git a/crates/nu-command/src/filters/filter.rs b/crates/nu-command/src/filters/filter.rs index 2e516de4e8..e8854f2bbf 100644 --- a/crates/nu-command/src/filters/filter.rs +++ b/crates/nu-command/src/filters/filter.rs @@ -3,8 +3,8 @@ use nu_engine::{eval_block, CallExt}; use nu_protocol::ast::Call; use nu_protocol::engine::{Closure, Command, EngineState, Stack}; use nu_protocol::{ - Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, Signature, - Span, SyntaxShape, Type, Value, + Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, ShellError, + Signature, Span, SyntaxShape, Type, Value, }; #[derive(Clone)] @@ -51,7 +51,7 @@ a variable. On the other hand, the "row condition" syntax is not supported."# stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let capture_block: Closure = call.req(engine_state, stack, 0)?; let metadata = input.metadata(); let ctrlc = engine_state.ctrlc.clone(); diff --git a/crates/nu-command/src/filters/first.rs b/crates/nu-command/src/filters/first.rs index cd52973a32..194e85a5f0 100644 --- a/crates/nu-command/src/filters/first.rs +++ b/crates/nu-command/src/filters/first.rs @@ -52,7 +52,7 @@ impl Command for First { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { first_helper(engine_state, stack, call, input) } @@ -88,7 +88,7 @@ fn first_helper( stack: &mut Stack, call: &Call, input: PipelineData, -) -> Result { +) -> Result { let head = call.head; let rows: Option = call.opt(engine_state, stack, 0)?; // FIXME: for backwards compatibility reasons, if `rows` is not specified we diff --git a/crates/nu-command/src/filters/flatten.rs b/crates/nu-command/src/filters/flatten.rs index be9a5426a3..49961bfd8c 100644 --- a/crates/nu-command/src/filters/flatten.rs +++ b/crates/nu-command/src/filters/flatten.rs @@ -43,7 +43,7 @@ impl Command for Flatten { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { flatten(engine_state, stack, call, input) } @@ -117,7 +117,7 @@ fn flatten( stack: &mut Stack, call: &Call, input: PipelineData, -) -> Result { +) -> Result { let tag = call.head; let columns: Vec = call.rest(engine_state, stack, 0)?; let metadata = input.metadata(); diff --git a/crates/nu-command/src/filters/get.rs b/crates/nu-command/src/filters/get.rs index 4f28c8cfcc..8d84e533f8 100644 --- a/crates/nu-command/src/filters/get.rs +++ b/crates/nu-command/src/filters/get.rs @@ -2,8 +2,8 @@ use nu_engine::CallExt; use nu_protocol::ast::{Call, CellPath}; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ - Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, Signature, - Span, SyntaxShape, Type, Value, + Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, ShellError, + Signature, Span, SyntaxShape, Type, Value, }; #[derive(Clone)] @@ -54,7 +54,7 @@ impl Command for Get { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let span = call.head; let cell_path: CellPath = call.req(engine_state, stack, 0)?; let rest: Vec = call.rest(engine_state, stack, 1)?; diff --git a/crates/nu-command/src/filters/group.rs b/crates/nu-command/src/filters/group.rs index 6636b19458..3f4403cc03 100644 --- a/crates/nu-command/src/filters/group.rs +++ b/crates/nu-command/src/filters/group.rs @@ -2,8 +2,8 @@ use nu_engine::CallExt; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ - Category, Example, IntoInterruptiblePipelineData, PipelineData, Signature, Span, Spanned, - SyntaxShape, Type, Value, + Category, Example, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature, Span, + Spanned, SyntaxShape, Type, Value, }; #[derive(Clone)] @@ -60,7 +60,7 @@ impl Command for Group { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let group_size: Spanned = call.req(engine_state, stack, 0)?; let ctrlc = engine_state.ctrlc.clone(); let metadata = input.metadata(); diff --git a/crates/nu-command/src/filters/group_by.rs b/crates/nu-command/src/filters/group_by.rs index 61cb03ea8d..c352920428 100644 --- a/crates/nu-command/src/filters/group_by.rs +++ b/crates/nu-command/src/filters/group_by.rs @@ -39,7 +39,7 @@ impl Command for GroupBy { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { group_by(engine_state, stack, call, input) } diff --git a/crates/nu-command/src/filters/headers.rs b/crates/nu-command/src/filters/headers.rs index 52306deb5d..c67c0b1a68 100644 --- a/crates/nu-command/src/filters/headers.rs +++ b/crates/nu-command/src/filters/headers.rs @@ -85,7 +85,7 @@ impl Command for Headers { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let config = engine_state.get_config(); let metadata = input.metadata(); let value = input.into_value(call.head); diff --git a/crates/nu-command/src/filters/insert.rs b/crates/nu-command/src/filters/insert.rs index 3a6d7ab03b..1086484c35 100644 --- a/crates/nu-command/src/filters/insert.rs +++ b/crates/nu-command/src/filters/insert.rs @@ -47,7 +47,7 @@ impl Command for Insert { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { insert(engine_state, stack, call, input) } diff --git a/crates/nu-command/src/filters/length.rs b/crates/nu-command/src/filters/length.rs index c39bfe7450..f3ec9dbdd1 100644 --- a/crates/nu-command/src/filters/length.rs +++ b/crates/nu-command/src/filters/length.rs @@ -38,7 +38,7 @@ impl Command for Length { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let col = call.has_flag("column"); if col { length_col(engine_state, call, input) diff --git a/crates/nu-command/src/filters/lines.rs b/crates/nu-command/src/filters/lines.rs index 65e4694508..302d9fc268 100644 --- a/crates/nu-command/src/filters/lines.rs +++ b/crates/nu-command/src/filters/lines.rs @@ -34,7 +34,7 @@ impl Command for Lines { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let ctrlc = engine_state.ctrlc.clone(); let skip_empty = call.has_flag("skip-empty"); diff --git a/crates/nu-command/src/filters/merge.rs b/crates/nu-command/src/filters/merge.rs index 53cc2497e3..99e351751d 100644 --- a/crates/nu-command/src/filters/merge.rs +++ b/crates/nu-command/src/filters/merge.rs @@ -93,7 +93,7 @@ repeating this process with row 1, and so on."# stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let merge_value: Value = call.req(engine_state, stack, 0)?; let metadata = input.metadata(); diff --git a/crates/nu-command/src/filters/move_.rs b/crates/nu-command/src/filters/move_.rs index 8618de7b8e..9d436e1cc1 100644 --- a/crates/nu-command/src/filters/move_.rs +++ b/crates/nu-command/src/filters/move_.rs @@ -109,7 +109,7 @@ impl Command for Move { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let columns: Vec = call.rest(engine_state, stack, 0)?; let after: Option = call.get_flag(engine_state, stack, "after")?; let before: Option = call.get_flag(engine_state, stack, "before")?; diff --git a/crates/nu-command/src/filters/par_each.rs b/crates/nu-command/src/filters/par_each.rs index 8bb373dea8..9cd8e1f83f 100644 --- a/crates/nu-command/src/filters/par_each.rs +++ b/crates/nu-command/src/filters/par_each.rs @@ -2,8 +2,8 @@ use nu_engine::{eval_block_with_early_return, CallExt}; use nu_protocol::ast::Call; use nu_protocol::engine::{Closure, Command, EngineState, Stack}; use nu_protocol::{ - Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, Signature, - Span, SyntaxShape, Type, Value, + Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, ShellError, + Signature, Span, SyntaxShape, Type, Value, }; use rayon::prelude::*; @@ -84,7 +84,7 @@ impl Command for ParEach { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let capture_block: Closure = call.req(engine_state, stack, 0)?; let metadata = input.metadata(); diff --git a/crates/nu-command/src/filters/reject.rs b/crates/nu-command/src/filters/reject.rs index 6557f9843c..e59929fd14 100644 --- a/crates/nu-command/src/filters/reject.rs +++ b/crates/nu-command/src/filters/reject.rs @@ -38,7 +38,7 @@ impl Command for Reject { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let columns: Vec = call.rest(engine_state, stack, 0)?; let span = call.head; reject(engine_state, span, input, columns) diff --git a/crates/nu-command/src/filters/rename.rs b/crates/nu-command/src/filters/rename.rs index 4962b5fb61..e5574dcc5b 100644 --- a/crates/nu-command/src/filters/rename.rs +++ b/crates/nu-command/src/filters/rename.rs @@ -39,7 +39,7 @@ impl Command for Rename { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { rename(engine_state, stack, call, input) } @@ -99,7 +99,7 @@ fn rename( stack: &mut Stack, call: &Call, input: PipelineData, -) -> Result { +) -> Result { let specified_column: Option> = call.get_flag(engine_state, stack, "column")?; // get the span for the column's name to be changed and for the given list let (specified_col_span, list_span) = if let Some(Value::List { diff --git a/crates/nu-command/src/filters/roll/roll_down.rs b/crates/nu-command/src/filters/roll/roll_down.rs index 770108d838..ede1901993 100644 --- a/crates/nu-command/src/filters/roll/roll_down.rs +++ b/crates/nu-command/src/filters/roll/roll_down.rs @@ -66,7 +66,7 @@ impl Command for RollDown { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let by: Option = call.get_flag(engine_state, stack, "by")?; let metadata = input.metadata(); diff --git a/crates/nu-command/src/filters/roll/roll_left.rs b/crates/nu-command/src/filters/roll/roll_left.rs index 3697319585..33c35b7f47 100644 --- a/crates/nu-command/src/filters/roll/roll_left.rs +++ b/crates/nu-command/src/filters/roll/roll_left.rs @@ -104,7 +104,7 @@ impl Command for RollLeft { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let by: Option = call.get_flag(engine_state, stack, "by")?; let metadata = input.metadata(); diff --git a/crates/nu-command/src/filters/roll/roll_right.rs b/crates/nu-command/src/filters/roll/roll_right.rs index b33a22b736..ff9d1d308a 100644 --- a/crates/nu-command/src/filters/roll/roll_right.rs +++ b/crates/nu-command/src/filters/roll/roll_right.rs @@ -104,7 +104,7 @@ impl Command for RollRight { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let by: Option = call.get_flag(engine_state, stack, "by")?; let metadata = input.metadata(); diff --git a/crates/nu-command/src/filters/roll/roll_up.rs b/crates/nu-command/src/filters/roll/roll_up.rs index 5d136d1547..70ddf60b90 100644 --- a/crates/nu-command/src/filters/roll/roll_up.rs +++ b/crates/nu-command/src/filters/roll/roll_up.rs @@ -66,7 +66,7 @@ impl Command for RollUp { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let by: Option = call.get_flag(engine_state, stack, "by")?; let metadata = input.metadata(); diff --git a/crates/nu-command/src/filters/select.rs b/crates/nu-command/src/filters/select.rs index a05bf50204..f8b7a75cd8 100644 --- a/crates/nu-command/src/filters/select.rs +++ b/crates/nu-command/src/filters/select.rs @@ -48,7 +48,7 @@ impl Command for Select { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let columns: Vec = call.rest(engine_state, stack, 0)?; let span = call.head; let ignore_errors = call.has_flag("ignore-errors"); diff --git a/crates/nu-command/src/filters/split_by.rs b/crates/nu-command/src/filters/split_by.rs index 6991d28de3..ce95d2478c 100644 --- a/crates/nu-command/src/filters/split_by.rs +++ b/crates/nu-command/src/filters/split_by.rs @@ -30,7 +30,7 @@ impl Command for SplitBy { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { split_by(engine_state, stack, call, input) } diff --git a/crates/nu-command/src/filters/take/take_.rs b/crates/nu-command/src/filters/take/take_.rs index 5fd4130116..92f263959e 100644 --- a/crates/nu-command/src/filters/take/take_.rs +++ b/crates/nu-command/src/filters/take/take_.rs @@ -47,7 +47,7 @@ impl Command for Take { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let rows_desired: usize = call.req(engine_state, stack, 0)?; let ctrlc = engine_state.ctrlc.clone(); diff --git a/crates/nu-command/src/filters/transpose.rs b/crates/nu-command/src/filters/transpose.rs index a20b0ffc44..1092161a08 100644 --- a/crates/nu-command/src/filters/transpose.rs +++ b/crates/nu-command/src/filters/transpose.rs @@ -76,7 +76,7 @@ impl Command for Transpose { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { transpose(engine_state, stack, call, input) } @@ -159,7 +159,7 @@ pub fn transpose( stack: &mut Stack, call: &Call, input: PipelineData, -) -> Result { +) -> Result { let name = call.head; let transpose_args = TransposeArgs { header_row: call.has_flag("header-row"), diff --git a/crates/nu-command/src/filters/uniq.rs b/crates/nu-command/src/filters/uniq.rs index d459a92726..af527b9887 100644 --- a/crates/nu-command/src/filters/uniq.rs +++ b/crates/nu-command/src/filters/uniq.rs @@ -67,7 +67,7 @@ impl Command for Uniq { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let mapper = Box::new(move |ms: ItemMapperState| -> ValueCounter { item_mapper(ms.item, ms.flag_ignore_case, ms.index) }); @@ -265,7 +265,7 @@ pub fn uniq( input: Vec, item_mapper: Box ValueCounter>, metadata: Option, -) -> Result { +) -> Result { let ctrlc = engine_state.ctrlc.clone(); let head = call.head; let flag_show_count = call.has_flag("count"); diff --git a/crates/nu-command/src/filters/uniq_by.rs b/crates/nu-command/src/filters/uniq_by.rs index 0be5de0db3..7510b4dd19 100644 --- a/crates/nu-command/src/filters/uniq_by.rs +++ b/crates/nu-command/src/filters/uniq_by.rs @@ -56,7 +56,7 @@ impl Command for UniqBy { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let columns: Vec = call.rest(engine_state, stack, 0)?; if columns.is_empty() { diff --git a/crates/nu-command/src/filters/update.rs b/crates/nu-command/src/filters/update.rs index 6c1db87c99..3919692e44 100644 --- a/crates/nu-command/src/filters/update.rs +++ b/crates/nu-command/src/filters/update.rs @@ -43,7 +43,7 @@ impl Command for Update { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { update(engine_state, stack, call, input) } diff --git a/crates/nu-command/src/filters/upsert.rs b/crates/nu-command/src/filters/upsert.rs index fea8d2b28d..eda402618d 100644 --- a/crates/nu-command/src/filters/upsert.rs +++ b/crates/nu-command/src/filters/upsert.rs @@ -47,7 +47,7 @@ impl Command for Upsert { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { upsert(engine_state, stack, call, input) } diff --git a/crates/nu-command/src/filters/where_.rs b/crates/nu-command/src/filters/where_.rs index 74c0849dc2..1df21ffac2 100644 --- a/crates/nu-command/src/filters/where_.rs +++ b/crates/nu-command/src/filters/where_.rs @@ -2,8 +2,8 @@ use nu_engine::{eval_block, CallExt}; use nu_protocol::ast::Call; use nu_protocol::engine::{Closure, Command, EngineState, Stack}; use nu_protocol::{ - Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, Signature, - Span, SyntaxShape, Type, Value, + Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, ShellError, + Signature, Span, SyntaxShape, Type, Value, }; #[derive(Clone)] @@ -51,7 +51,7 @@ not supported."# stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let closure: Closure = call.req(engine_state, stack, 0)?; let span = call.head; diff --git a/crates/nu-command/src/filters/window.rs b/crates/nu-command/src/filters/window.rs index c56e150122..b92a22ce1f 100644 --- a/crates/nu-command/src/filters/window.rs +++ b/crates/nu-command/src/filters/window.rs @@ -2,8 +2,8 @@ use nu_engine::CallExt; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ - Category, Example, IntoInterruptiblePipelineData, PipelineData, Signature, Span, Spanned, - SyntaxShape, Type, Value, + Category, Example, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature, Span, + Spanned, SyntaxShape, Type, Value, }; #[derive(Clone)] @@ -115,7 +115,7 @@ impl Command for Window { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let group_size: Spanned = call.req(engine_state, stack, 0)?; let ctrlc = engine_state.ctrlc.clone(); let metadata = input.metadata(); diff --git a/crates/nu-command/src/filters/wrap.rs b/crates/nu-command/src/filters/wrap.rs index 41a07e573d..3cee9da095 100644 --- a/crates/nu-command/src/filters/wrap.rs +++ b/crates/nu-command/src/filters/wrap.rs @@ -2,8 +2,8 @@ use nu_engine::CallExt; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ - Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, Signature, - Span, SyntaxShape, Type, Value, + Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, ShellError, + Signature, Span, SyntaxShape, Type, Value, }; #[derive(Clone)] @@ -34,7 +34,7 @@ impl Command for Wrap { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let span = call.head; let name: String = call.req(engine_state, stack, 0)?; let metadata = input.metadata(); diff --git a/crates/nu-command/src/filters/zip.rs b/crates/nu-command/src/filters/zip.rs index 7919cefc75..e21feaeaa0 100644 --- a/crates/nu-command/src/filters/zip.rs +++ b/crates/nu-command/src/filters/zip.rs @@ -2,8 +2,8 @@ use nu_engine::CallExt; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ - Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, Signature, - Span, SyntaxShape, Type, Value, + Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, ShellError, + Signature, Span, SyntaxShape, Type, Value, }; #[derive(Clone)] @@ -90,7 +90,7 @@ impl Command for Zip { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let other: Value = call.req(engine_state, stack, 0)?; let head = call.head; let ctrlc = engine_state.ctrlc.clone(); diff --git a/crates/nu-command/src/formats/from/command.rs b/crates/nu-command/src/formats/from/command.rs index b0fd3b4050..ee02bd7cfd 100644 --- a/crates/nu-command/src/formats/from/command.rs +++ b/crates/nu-command/src/formats/from/command.rs @@ -31,7 +31,7 @@ impl Command for From { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(Value::String { val: get_full_help( &From.signature(), diff --git a/crates/nu-command/src/formats/from/csv.rs b/crates/nu-command/src/formats/from/csv.rs index 363a2324e6..fc03cbfbf5 100644 --- a/crates/nu-command/src/formats/from/csv.rs +++ b/crates/nu-command/src/formats/from/csv.rs @@ -49,7 +49,7 @@ impl Command for FromCsv { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { from_csv(engine_state, stack, call, input) } diff --git a/crates/nu-command/src/formats/from/eml.rs b/crates/nu-command/src/formats/from/eml.rs index 0759f65482..70c86e7bfb 100644 --- a/crates/nu-command/src/formats/from/eml.rs +++ b/crates/nu-command/src/formats/from/eml.rs @@ -41,7 +41,7 @@ impl Command for FromEml { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let preview_body: Option> = call.get_flag(engine_state, stack, "preview-body")?; diff --git a/crates/nu-command/src/formats/from/ics.rs b/crates/nu-command/src/formats/from/ics.rs index cecc64b99f..469b6a8f29 100644 --- a/crates/nu-command/src/formats/from/ics.rs +++ b/crates/nu-command/src/formats/from/ics.rs @@ -34,7 +34,7 @@ impl Command for FromIcs { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; from_ics(input, head) } diff --git a/crates/nu-command/src/formats/from/ini.rs b/crates/nu-command/src/formats/from/ini.rs index 33d42171d9..4875e2b6ed 100644 --- a/crates/nu-command/src/formats/from/ini.rs +++ b/crates/nu-command/src/formats/from/ini.rs @@ -47,7 +47,7 @@ b=2' | from ini", _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; from_ini(input, head) } diff --git a/crates/nu-command/src/formats/from/json.rs b/crates/nu-command/src/formats/from/json.rs index 08a6a45453..d068b6fb9b 100644 --- a/crates/nu-command/src/formats/from/json.rs +++ b/crates/nu-command/src/formats/from/json.rs @@ -59,7 +59,7 @@ impl Command for FromJson { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let span = call.head; let (string_input, span, metadata) = input.collect_string_strict(span)?; diff --git a/crates/nu-command/src/formats/from/nuon.rs b/crates/nu-command/src/formats/from/nuon.rs index 9514e253e9..40912ffa7f 100644 --- a/crates/nu-command/src/formats/from/nuon.rs +++ b/crates/nu-command/src/formats/from/nuon.rs @@ -57,7 +57,7 @@ impl Command for FromNuon { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let (string_input, _span, metadata) = input.collect_string_strict(head)?; diff --git a/crates/nu-command/src/formats/from/ods.rs b/crates/nu-command/src/formats/from/ods.rs index a0b733b8d4..86d4e328f4 100644 --- a/crates/nu-command/src/formats/from/ods.rs +++ b/crates/nu-command/src/formats/from/ods.rs @@ -39,7 +39,7 @@ impl Command for FromOds { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let sel_sheets = if let Some(Value::List { vals: columns, .. }) = diff --git a/crates/nu-command/src/formats/from/ssv.rs b/crates/nu-command/src/formats/from/ssv.rs index 24afbeb337..15e9310749 100644 --- a/crates/nu-command/src/formats/from/ssv.rs +++ b/crates/nu-command/src/formats/from/ssv.rs @@ -60,7 +60,7 @@ impl Command for FromSsv { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { from_ssv(engine_state, stack, call, input) } } diff --git a/crates/nu-command/src/formats/from/toml.rs b/crates/nu-command/src/formats/from/toml.rs index 98012ce3dd..6214169737 100644 --- a/crates/nu-command/src/formats/from/toml.rs +++ b/crates/nu-command/src/formats/from/toml.rs @@ -58,7 +58,7 @@ b = [1, 2]' | from toml", _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let span = call.head; let (mut string_input, span, metadata) = input.collect_string_strict(span)?; string_input.push('\n'); diff --git a/crates/nu-command/src/formats/from/tsv.rs b/crates/nu-command/src/formats/from/tsv.rs index 40e9dbfd0a..eb48474dc1 100644 --- a/crates/nu-command/src/formats/from/tsv.rs +++ b/crates/nu-command/src/formats/from/tsv.rs @@ -43,7 +43,7 @@ impl Command for FromTsv { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { from_tsv(engine_state, stack, call, input) } diff --git a/crates/nu-command/src/formats/from/url.rs b/crates/nu-command/src/formats/from/url.rs index e20294a9d6..881ee33a46 100644 --- a/crates/nu-command/src/formats/from/url.rs +++ b/crates/nu-command/src/formats/from/url.rs @@ -26,7 +26,7 @@ impl Command for FromUrl { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; from_url(input, head) } diff --git a/crates/nu-command/src/formats/from/vcf.rs b/crates/nu-command/src/formats/from/vcf.rs index 7356056357..91e8889dc0 100644 --- a/crates/nu-command/src/formats/from/vcf.rs +++ b/crates/nu-command/src/formats/from/vcf.rs @@ -32,7 +32,7 @@ impl Command for FromVcf { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; from_vcf(input, head) } diff --git a/crates/nu-command/src/formats/from/xlsx.rs b/crates/nu-command/src/formats/from/xlsx.rs index 4f1a0c5402..e1198567c7 100644 --- a/crates/nu-command/src/formats/from/xlsx.rs +++ b/crates/nu-command/src/formats/from/xlsx.rs @@ -39,7 +39,7 @@ impl Command for FromXlsx { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let sel_sheets = if let Some(Value::List { vals: columns, .. }) = diff --git a/crates/nu-command/src/formats/from/xml.rs b/crates/nu-command/src/formats/from/xml.rs index cb5c3ea4b6..ee29262e20 100644 --- a/crates/nu-command/src/formats/from/xml.rs +++ b/crates/nu-command/src/formats/from/xml.rs @@ -30,7 +30,7 @@ impl Command for FromXml { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; from_xml(input, head) } diff --git a/crates/nu-command/src/formats/from/yaml.rs b/crates/nu-command/src/formats/from/yaml.rs index 99d2fbc844..43dcc138f7 100644 --- a/crates/nu-command/src/formats/from/yaml.rs +++ b/crates/nu-command/src/formats/from/yaml.rs @@ -36,7 +36,7 @@ impl Command for FromYaml { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; from_yaml(input, head) } @@ -66,7 +66,7 @@ impl Command for FromYml { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; from_yaml(input, head) } diff --git a/crates/nu-command/src/formats/to/command.rs b/crates/nu-command/src/formats/to/command.rs index 6a931366fe..9b942cd01d 100644 --- a/crates/nu-command/src/formats/to/command.rs +++ b/crates/nu-command/src/formats/to/command.rs @@ -31,7 +31,7 @@ impl Command for To { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(Value::String { val: get_full_help( &To.signature(), diff --git a/crates/nu-command/src/formats/to/csv.rs b/crates/nu-command/src/formats/to/csv.rs index fe5743c3ab..08659b658d 100644 --- a/crates/nu-command/src/formats/to/csv.rs +++ b/crates/nu-command/src/formats/to/csv.rs @@ -65,7 +65,7 @@ impl Command for ToCsv { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let noheaders = call.has_flag("noheaders"); let separator: Option> = call.get_flag(engine_state, stack, "separator")?; diff --git a/crates/nu-command/src/formats/to/html.rs b/crates/nu-command/src/formats/to/html.rs index 5226d01862..b1ce78e6c2 100644 --- a/crates/nu-command/src/formats/to/html.rs +++ b/crates/nu-command/src/formats/to/html.rs @@ -157,7 +157,7 @@ impl Command for ToHtml { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { to_html(input, call, engine_state, stack) } } diff --git a/crates/nu-command/src/formats/to/json.rs b/crates/nu-command/src/formats/to/json.rs index 3cf9c166d2..f598de4a6a 100644 --- a/crates/nu-command/src/formats/to/json.rs +++ b/crates/nu-command/src/formats/to/json.rs @@ -43,7 +43,7 @@ impl Command for ToJson { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let raw = call.has_flag("raw"); let use_tabs = call.has_flag("tabs"); diff --git a/crates/nu-command/src/formats/to/md.rs b/crates/nu-command/src/formats/to/md.rs index 3035f92288..90d187e917 100644 --- a/crates/nu-command/src/formats/to/md.rs +++ b/crates/nu-command/src/formats/to/md.rs @@ -70,7 +70,7 @@ impl Command for ToMd { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let pretty = call.has_flag("pretty"); let per_element = call.has_flag("per-element"); diff --git a/crates/nu-command/src/formats/to/nuon.rs b/crates/nu-command/src/formats/to/nuon.rs index f457b4eecf..abe34c0548 100644 --- a/crates/nu-command/src/formats/to/nuon.rs +++ b/crates/nu-command/src/formats/to/nuon.rs @@ -33,7 +33,7 @@ impl Command for ToNuon { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { Ok(Value::String { val: to_nuon(call, input)?, span: call.head, diff --git a/crates/nu-command/src/formats/to/text.rs b/crates/nu-command/src/formats/to/text.rs index 12202d6377..22085780b1 100644 --- a/crates/nu-command/src/formats/to/text.rs +++ b/crates/nu-command/src/formats/to/text.rs @@ -30,7 +30,7 @@ impl Command for ToText { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let span = call.head; let config = engine_state.get_config(); diff --git a/crates/nu-command/src/formats/to/toml.rs b/crates/nu-command/src/formats/to/toml.rs index 5a93fe25c5..f3e2236fac 100644 --- a/crates/nu-command/src/formats/to/toml.rs +++ b/crates/nu-command/src/formats/to/toml.rs @@ -36,7 +36,7 @@ impl Command for ToToml { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; to_toml(engine_state, input, head) } diff --git a/crates/nu-command/src/formats/to/xml.rs b/crates/nu-command/src/formats/to/xml.rs index 371d282cdc..cd20b15bdb 100644 --- a/crates/nu-command/src/formats/to/xml.rs +++ b/crates/nu-command/src/formats/to/xml.rs @@ -60,7 +60,7 @@ impl Command for ToXml { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let config = engine_state.get_config(); let pretty: Option> = call.get_flag(engine_state, stack, "pretty")?; diff --git a/crates/nu-command/src/formats/to/yaml.rs b/crates/nu-command/src/formats/to/yaml.rs index 1b7724cf9c..a4b9242378 100644 --- a/crates/nu-command/src/formats/to/yaml.rs +++ b/crates/nu-command/src/formats/to/yaml.rs @@ -36,7 +36,7 @@ impl Command for ToYaml { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; to_yaml(input, head) } diff --git a/crates/nu-command/src/generators/cal.rs b/crates/nu-command/src/generators/cal.rs index 792fa4e806..9a199f7f2b 100644 --- a/crates/nu-command/src/generators/cal.rs +++ b/crates/nu-command/src/generators/cal.rs @@ -63,7 +63,7 @@ impl Command for Cal { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { cal(engine_state, stack, call, input) } @@ -94,7 +94,7 @@ pub fn cal( call: &Call, // TODO: Error if a value is piped in _input: PipelineData, -) -> Result { +) -> Result { let mut calendar_vec_deque = VecDeque::new(); let tag = call.head; diff --git a/crates/nu-command/src/generators/seq_char.rs b/crates/nu-command/src/generators/seq_char.rs index 33ce9144ac..1f33af3de4 100644 --- a/crates/nu-command/src/generators/seq_char.rs +++ b/crates/nu-command/src/generators/seq_char.rs @@ -64,7 +64,7 @@ impl Command for SeqChar { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { seq_char(engine_state, stack, call) } } diff --git a/crates/nu-command/src/generators/seq_date.rs b/crates/nu-command/src/generators/seq_date.rs index 971d043213..7bbb319ba0 100644 --- a/crates/nu-command/src/generators/seq_date.rs +++ b/crates/nu-command/src/generators/seq_date.rs @@ -119,7 +119,7 @@ impl Command for SeqDate { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { let output_format: Option> = call.get_flag(engine_state, stack, "output-format")?; let input_format: Option> = diff --git a/crates/nu-command/src/hash/generic_digest.rs b/crates/nu-command/src/hash/generic_digest.rs index 0cf346664f..014770f0ac 100644 --- a/crates/nu-command/src/hash/generic_digest.rs +++ b/crates/nu-command/src/hash/generic_digest.rs @@ -80,7 +80,7 @@ where stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let binary = call.has_flag("binary"); let cell_paths: Vec = call.rest(engine_state, stack, 0)?; let cell_paths = (!cell_paths.is_empty()).then_some(cell_paths); diff --git a/crates/nu-command/src/math/abs.rs b/crates/nu-command/src/math/abs.rs index 546a0ee427..64dd860b62 100644 --- a/crates/nu-command/src/math/abs.rs +++ b/crates/nu-command/src/math/abs.rs @@ -31,7 +31,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; input.map( move |value| abs_helper(value, head), diff --git a/crates/nu-command/src/math/arccos.rs b/crates/nu-command/src/math/arccos.rs index c158c199c6..18b1f890c5 100644 --- a/crates/nu-command/src/math/arccos.rs +++ b/crates/nu-command/src/math/arccos.rs @@ -32,7 +32,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let use_degrees = call.has_flag("degrees"); // This doesn't match explicit nulls diff --git a/crates/nu-command/src/math/arccosh.rs b/crates/nu-command/src/math/arccosh.rs index 9bfb2b2d1d..440ad67584 100644 --- a/crates/nu-command/src/math/arccosh.rs +++ b/crates/nu-command/src/math/arccosh.rs @@ -31,7 +31,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; // This doesn't match explicit nulls if matches!(input, PipelineData::Empty) { diff --git a/crates/nu-command/src/math/arcsin.rs b/crates/nu-command/src/math/arcsin.rs index ed1c002289..e84a19b6ef 100644 --- a/crates/nu-command/src/math/arcsin.rs +++ b/crates/nu-command/src/math/arcsin.rs @@ -32,7 +32,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let use_degrees = call.has_flag("degrees"); // This doesn't match explicit nulls diff --git a/crates/nu-command/src/math/arcsinh.rs b/crates/nu-command/src/math/arcsinh.rs index 743cee882e..4072c5e4c0 100644 --- a/crates/nu-command/src/math/arcsinh.rs +++ b/crates/nu-command/src/math/arcsinh.rs @@ -31,7 +31,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; // This doesn't match explicit nulls if matches!(input, PipelineData::Empty) { diff --git a/crates/nu-command/src/math/arctan.rs b/crates/nu-command/src/math/arctan.rs index 92aabc008f..ae985c2406 100644 --- a/crates/nu-command/src/math/arctan.rs +++ b/crates/nu-command/src/math/arctan.rs @@ -32,7 +32,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let use_degrees = call.has_flag("degrees"); // This doesn't match explicit nulls diff --git a/crates/nu-command/src/math/arctanh.rs b/crates/nu-command/src/math/arctanh.rs index d234ef5bd2..5d2ca9fd59 100644 --- a/crates/nu-command/src/math/arctanh.rs +++ b/crates/nu-command/src/math/arctanh.rs @@ -31,7 +31,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; // This doesn't match explicit nulls if matches!(input, PipelineData::Empty) { diff --git a/crates/nu-command/src/math/avg.rs b/crates/nu-command/src/math/avg.rs index c081d2b3ee..8c38cdda8e 100644 --- a/crates/nu-command/src/math/avg.rs +++ b/crates/nu-command/src/math/avg.rs @@ -32,7 +32,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { run_with_function(call, input, average) } diff --git a/crates/nu-command/src/math/ceil.rs b/crates/nu-command/src/math/ceil.rs index 37b920cf4d..3627827fad 100644 --- a/crates/nu-command/src/math/ceil.rs +++ b/crates/nu-command/src/math/ceil.rs @@ -31,7 +31,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; // This doesn't match explicit nulls if matches!(input, PipelineData::Empty) { diff --git a/crates/nu-command/src/math/cos.rs b/crates/nu-command/src/math/cos.rs index c64482a04e..80606c76ae 100644 --- a/crates/nu-command/src/math/cos.rs +++ b/crates/nu-command/src/math/cos.rs @@ -32,7 +32,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let use_degrees = call.has_flag("degrees"); // This doesn't match explicit nulls diff --git a/crates/nu-command/src/math/cosh.rs b/crates/nu-command/src/math/cosh.rs index 7f4f699a88..3fa73c3e98 100644 --- a/crates/nu-command/src/math/cosh.rs +++ b/crates/nu-command/src/math/cosh.rs @@ -31,7 +31,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; // This doesn't match explicit nulls if matches!(input, PipelineData::Empty) { diff --git a/crates/nu-command/src/math/euler.rs b/crates/nu-command/src/math/euler.rs index 3bb7a3a111..fc01fb40f9 100644 --- a/crates/nu-command/src/math/euler.rs +++ b/crates/nu-command/src/math/euler.rs @@ -1,6 +1,8 @@ use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; -use nu_protocol::{Category, Example, IntoPipelineData, PipelineData, Signature, Type, Value}; +use nu_protocol::{ + Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value, +}; #[derive(Clone)] pub struct SubCommand; @@ -39,7 +41,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(Value::float(std::f64::consts::E, call.head).into_pipeline_data()) } } diff --git a/crates/nu-command/src/math/floor.rs b/crates/nu-command/src/math/floor.rs index 0354d8b7c2..b93dbce0d9 100644 --- a/crates/nu-command/src/math/floor.rs +++ b/crates/nu-command/src/math/floor.rs @@ -31,7 +31,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; // This doesn't match explicit nulls if matches!(input, PipelineData::Empty) { diff --git a/crates/nu-command/src/math/ln.rs b/crates/nu-command/src/math/ln.rs index de8d8cc11f..3f154c1445 100644 --- a/crates/nu-command/src/math/ln.rs +++ b/crates/nu-command/src/math/ln.rs @@ -31,7 +31,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; // This doesn't match explicit nulls if matches!(input, PipelineData::Empty) { diff --git a/crates/nu-command/src/math/log.rs b/crates/nu-command/src/math/log.rs index 03db7a3f6e..e86aa57bde 100644 --- a/crates/nu-command/src/math/log.rs +++ b/crates/nu-command/src/math/log.rs @@ -39,7 +39,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let base: Spanned = call.req(engine_state, stack, 0)?; diff --git a/crates/nu-command/src/math/math_.rs b/crates/nu-command/src/math/math_.rs index 2104c67689..5c0f897a3b 100644 --- a/crates/nu-command/src/math/math_.rs +++ b/crates/nu-command/src/math/math_.rs @@ -2,7 +2,7 @@ use nu_engine::get_full_help; use nu_protocol::{ ast::Call, engine::{Command, EngineState, Stack}, - Category, IntoPipelineData, PipelineData, Signature, Type, Value, + Category, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value, }; #[derive(Clone)] @@ -33,7 +33,7 @@ impl Command for MathCommand { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(Value::String { val: get_full_help( &MathCommand.signature(), diff --git a/crates/nu-command/src/math/max.rs b/crates/nu-command/src/math/max.rs index 290e13be4a..956d82719d 100644 --- a/crates/nu-command/src/math/max.rs +++ b/crates/nu-command/src/math/max.rs @@ -35,7 +35,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { run_with_function(call, input, maximum) } diff --git a/crates/nu-command/src/math/median.rs b/crates/nu-command/src/math/median.rs index 093709fcbe..d79d335924 100644 --- a/crates/nu-command/src/math/median.rs +++ b/crates/nu-command/src/math/median.rs @@ -37,7 +37,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { run_with_function(call, input, median) } diff --git a/crates/nu-command/src/math/min.rs b/crates/nu-command/src/math/min.rs index 2d0403d844..e63e0b607e 100644 --- a/crates/nu-command/src/math/min.rs +++ b/crates/nu-command/src/math/min.rs @@ -35,7 +35,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { run_with_function(call, input, minimum) } diff --git a/crates/nu-command/src/math/mode.rs b/crates/nu-command/src/math/mode.rs index 2fa0ad662e..7647d9f17a 100644 --- a/crates/nu-command/src/math/mode.rs +++ b/crates/nu-command/src/math/mode.rs @@ -61,7 +61,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { run_with_function(call, input, mode) } diff --git a/crates/nu-command/src/math/pi.rs b/crates/nu-command/src/math/pi.rs index bac4a81359..fb3aba2673 100644 --- a/crates/nu-command/src/math/pi.rs +++ b/crates/nu-command/src/math/pi.rs @@ -1,6 +1,8 @@ use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; -use nu_protocol::{Category, Example, IntoPipelineData, PipelineData, Signature, Type, Value}; +use nu_protocol::{ + Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value, +}; #[derive(Clone)] pub struct SubCommand; @@ -39,7 +41,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(Value::float(std::f64::consts::PI, call.head).into_pipeline_data()) } } diff --git a/crates/nu-command/src/math/product.rs b/crates/nu-command/src/math/product.rs index b21c7be283..4d46acbecb 100644 --- a/crates/nu-command/src/math/product.rs +++ b/crates/nu-command/src/math/product.rs @@ -32,7 +32,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { run_with_function(call, input, product) } diff --git a/crates/nu-command/src/math/round.rs b/crates/nu-command/src/math/round.rs index 3559fe5224..80b18b6456 100644 --- a/crates/nu-command/src/math/round.rs +++ b/crates/nu-command/src/math/round.rs @@ -40,7 +40,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let precision_param: Option = call.get_flag(engine_state, stack, "precision")?; let head = call.head; // This doesn't match explicit nulls diff --git a/crates/nu-command/src/math/sin.rs b/crates/nu-command/src/math/sin.rs index dcf91897fe..3fd1d7fa18 100644 --- a/crates/nu-command/src/math/sin.rs +++ b/crates/nu-command/src/math/sin.rs @@ -32,7 +32,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let use_degrees = call.has_flag("degrees"); // This doesn't match explicit nulls diff --git a/crates/nu-command/src/math/sinh.rs b/crates/nu-command/src/math/sinh.rs index 21d150f6a0..e9bc00518a 100644 --- a/crates/nu-command/src/math/sinh.rs +++ b/crates/nu-command/src/math/sinh.rs @@ -31,7 +31,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; // This doesn't match explicit nulls if matches!(input, PipelineData::Empty) { diff --git a/crates/nu-command/src/math/sqrt.rs b/crates/nu-command/src/math/sqrt.rs index 6ed450afa2..489f45162f 100644 --- a/crates/nu-command/src/math/sqrt.rs +++ b/crates/nu-command/src/math/sqrt.rs @@ -31,7 +31,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; // This doesn't match explicit nulls if matches!(input, PipelineData::Empty) { diff --git a/crates/nu-command/src/math/stddev.rs b/crates/nu-command/src/math/stddev.rs index 8ccd54d4b0..99e211ab79 100644 --- a/crates/nu-command/src/math/stddev.rs +++ b/crates/nu-command/src/math/stddev.rs @@ -44,7 +44,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let sample = call.has_flag("sample"); run_with_function(call, input, compute_stddev(sample)) } diff --git a/crates/nu-command/src/math/sum.rs b/crates/nu-command/src/math/sum.rs index 13fedc15b0..8e22eb14da 100644 --- a/crates/nu-command/src/math/sum.rs +++ b/crates/nu-command/src/math/sum.rs @@ -32,7 +32,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { run_with_function(call, input, summation) } diff --git a/crates/nu-command/src/math/tan.rs b/crates/nu-command/src/math/tan.rs index 762036caca..c03956a625 100644 --- a/crates/nu-command/src/math/tan.rs +++ b/crates/nu-command/src/math/tan.rs @@ -32,7 +32,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let use_degrees = call.has_flag("degrees"); // This doesn't match explicit nulls diff --git a/crates/nu-command/src/math/tanh.rs b/crates/nu-command/src/math/tanh.rs index 858e42f3cd..679e1d1fda 100644 --- a/crates/nu-command/src/math/tanh.rs +++ b/crates/nu-command/src/math/tanh.rs @@ -31,7 +31,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; // This doesn't match explicit nulls if matches!(input, PipelineData::Empty) { diff --git a/crates/nu-command/src/math/tau.rs b/crates/nu-command/src/math/tau.rs index f3883216d7..efbd93071a 100644 --- a/crates/nu-command/src/math/tau.rs +++ b/crates/nu-command/src/math/tau.rs @@ -1,6 +1,8 @@ use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; -use nu_protocol::{Category, Example, IntoPipelineData, PipelineData, Signature, Type, Value}; +use nu_protocol::{ + Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value, +}; #[derive(Clone)] pub struct SubCommand; @@ -39,7 +41,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(Value::float(std::f64::consts::TAU, call.head).into_pipeline_data()) } } diff --git a/crates/nu-command/src/math/utils.rs b/crates/nu-command/src/math/utils.rs index a7a5d975da..460bf450e3 100644 --- a/crates/nu-command/src/math/utils.rs +++ b/crates/nu-command/src/math/utils.rs @@ -6,7 +6,7 @@ pub fn run_with_function( call: &Call, input: PipelineData, mf: impl Fn(&[Value], Span, &Span) -> Result, -) -> Result { +) -> Result { let name = call.head; let res = calculate(input, name, mf); match res { diff --git a/crates/nu-command/src/math/variance.rs b/crates/nu-command/src/math/variance.rs index 35f4486f63..64291f0d44 100644 --- a/crates/nu-command/src/math/variance.rs +++ b/crates/nu-command/src/math/variance.rs @@ -36,7 +36,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let sample = call.has_flag("sample"); run_with_function(call, input, compute_variance(sample)) } diff --git a/crates/nu-command/src/misc/history.rs b/crates/nu-command/src/misc/history.rs index e1a201378c..cc2a06bca2 100644 --- a/crates/nu-command/src/misc/history.rs +++ b/crates/nu-command/src/misc/history.rs @@ -43,7 +43,7 @@ impl Command for History { _stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; // todo for sqlite history this command should be an alias to `open ~/.config/nushell/history.sqlite3 | get history` diff --git a/crates/nu-command/src/misc/history_session.rs b/crates/nu-command/src/misc/history_session.rs index fc8e2600c0..fe4d372d29 100644 --- a/crates/nu-command/src/misc/history_session.rs +++ b/crates/nu-command/src/misc/history_session.rs @@ -1,6 +1,8 @@ use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; -use nu_protocol::{Category, Example, IntoPipelineData, PipelineData, Signature, Type, Value}; +use nu_protocol::{ + Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value, +}; #[derive(Clone)] pub struct HistorySession; @@ -34,7 +36,7 @@ impl Command for HistorySession { _stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(Value::int(engine_state.history_session_id, call.head).into_pipeline_data()) } } diff --git a/crates/nu-command/src/misc/tutor.rs b/crates/nu-command/src/misc/tutor.rs index 7feea66625..78ffad38e3 100644 --- a/crates/nu-command/src/misc/tutor.rs +++ b/crates/nu-command/src/misc/tutor.rs @@ -47,7 +47,7 @@ impl Command for Tutor { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { tutor(engine_state, stack, call) } diff --git a/crates/nu-command/src/network/http/get.rs b/crates/nu-command/src/network/http/get.rs index 4a8a51306c..0a51d633df 100644 --- a/crates/nu-command/src/network/http/get.rs +++ b/crates/nu-command/src/network/http/get.rs @@ -84,7 +84,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { run_fetch(engine_state, stack, call, input) } @@ -123,7 +123,7 @@ fn run_fetch( stack: &mut Stack, call: &Call, _input: PipelineData, -) -> Result { +) -> Result { let args = Arguments { url: call.req(engine_state, stack, 0)?, raw: call.has_flag("raw"), diff --git a/crates/nu-command/src/network/http/http_.rs b/crates/nu-command/src/network/http/http_.rs index ddd7b15aff..91e8129761 100644 --- a/crates/nu-command/src/network/http/http_.rs +++ b/crates/nu-command/src/network/http/http_.rs @@ -2,7 +2,7 @@ use nu_engine::get_full_help; use nu_protocol::{ ast::Call, engine::{Command, EngineState, Stack}, - Category, IntoPipelineData, PipelineData, Signature, Type, Value, + Category, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value, }; #[derive(Clone)] @@ -39,7 +39,7 @@ impl Command for Http { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(Value::String { val: get_full_help( &Http.signature(), diff --git a/crates/nu-command/src/network/http/post.rs b/crates/nu-command/src/network/http/post.rs index 90bbfe0d30..14a8ea6b3e 100644 --- a/crates/nu-command/src/network/http/post.rs +++ b/crates/nu-command/src/network/http/post.rs @@ -89,7 +89,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { run_post(engine_state, stack, call, input) } fn examples(&self) -> Vec { @@ -142,7 +142,7 @@ fn run_post( stack: &mut Stack, call: &Call, _input: PipelineData, -) -> Result { +) -> Result { let args = Arguments { path: call.req(engine_state, stack, 0)?, body: call.req(engine_state, stack, 1)?, diff --git a/crates/nu-command/src/network/url/build_query.rs b/crates/nu-command/src/network/url/build_query.rs index 238f306994..a65d13bb35 100644 --- a/crates/nu-command/src/network/url/build_query.rs +++ b/crates/nu-command/src/network/url/build_query.rs @@ -55,7 +55,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; to_url(input, head) } diff --git a/crates/nu-command/src/network/url/join.rs b/crates/nu-command/src/network/url/join.rs index 6fd6ab3b31..f08e7c64e5 100644 --- a/crates/nu-command/src/network/url/join.rs +++ b/crates/nu-command/src/network/url/join.rs @@ -1,5 +1,8 @@ +use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; -use nu_protocol::{Category, Example, IntoPipelineData, ShellError, Signature, Span, Type, Value}; +use nu_protocol::{ + Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, Type, Value, +}; #[derive(Clone)] pub struct SubCommand; @@ -29,7 +32,7 @@ impl Command for SubCommand { vec![ Example { description: "Outputs a url representing the contents of this record", - example: r#"{ + example: r#"{ "scheme": "http", "username": "", "password": "", @@ -81,9 +84,9 @@ impl Command for SubCommand { &self, _engine_state: &EngineState, _stack: &mut Stack, - call: &nu_protocol::ast::Call, - input: nu_protocol::PipelineData, - ) -> Result { + call: &Call, + input: PipelineData, + ) -> Result { let head = call.head; let output: Result = input diff --git a/crates/nu-command/src/network/url/url_.rs b/crates/nu-command/src/network/url/url_.rs index 9b14177fb2..0aa177b986 100644 --- a/crates/nu-command/src/network/url/url_.rs +++ b/crates/nu-command/src/network/url/url_.rs @@ -2,7 +2,7 @@ use nu_engine::get_full_help; use nu_protocol::{ ast::Call, engine::{Command, EngineState, Stack}, - Category, IntoPipelineData, PipelineData, Signature, Type, Value, + Category, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value, }; #[derive(Clone)] @@ -37,7 +37,7 @@ impl Command for Url { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(Value::String { val: get_full_help( &Url.signature(), diff --git a/crates/nu-command/src/path/basename.rs b/crates/nu-command/src/path/basename.rs index ce75b6240e..47ee054c07 100644 --- a/crates/nu-command/src/path/basename.rs +++ b/crates/nu-command/src/path/basename.rs @@ -1,6 +1,8 @@ use std::path::Path; use nu_engine::CallExt; +use nu_protocol::ast::Call; +use nu_protocol::engine::{EngineState, Stack}; use nu_protocol::{ engine::Command, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Type, Value, @@ -54,11 +56,11 @@ impl Command for SubCommand { fn run( &self, - engine_state: &nu_protocol::engine::EngineState, - stack: &mut nu_protocol::engine::Stack, - call: &nu_protocol::ast::Call, - input: nu_protocol::PipelineData, - ) -> Result { + engine_state: &EngineState, + stack: &mut Stack, + call: &Call, + input: PipelineData, + ) -> Result { let head = call.head; let args = Arguments { columns: call.get_flag(engine_state, stack, "columns")?, diff --git a/crates/nu-command/src/path/dirname.rs b/crates/nu-command/src/path/dirname.rs index 8858f12d68..88217fc22b 100644 --- a/crates/nu-command/src/path/dirname.rs +++ b/crates/nu-command/src/path/dirname.rs @@ -1,6 +1,8 @@ use std::path::Path; use nu_engine::CallExt; +use nu_protocol::ast::Call; +use nu_protocol::engine::{EngineState, Stack}; use nu_protocol::{ engine::Command, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Type, Value, @@ -57,11 +59,11 @@ impl Command for SubCommand { fn run( &self, - engine_state: &nu_protocol::engine::EngineState, - stack: &mut nu_protocol::engine::Stack, - call: &nu_protocol::ast::Call, - input: nu_protocol::PipelineData, - ) -> Result { + engine_state: &EngineState, + stack: &mut Stack, + call: &Call, + input: PipelineData, + ) -> Result { let head = call.head; let args = Arguments { columns: call.get_flag(engine_state, stack, "columns")?, diff --git a/crates/nu-command/src/path/exists.rs b/crates/nu-command/src/path/exists.rs index a0d1c9d324..f25f94ffab 100644 --- a/crates/nu-command/src/path/exists.rs +++ b/crates/nu-command/src/path/exists.rs @@ -2,6 +2,8 @@ use std::path::{Path, PathBuf}; use nu_engine::{current_dir, CallExt}; use nu_path::expand_path_with; +use nu_protocol::ast::Call; +use nu_protocol::engine::{EngineState, Stack}; use nu_protocol::{ engine::Command, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value, }; @@ -49,11 +51,11 @@ If you need to distinguish dirs and files, please use `path type`."# fn run( &self, - engine_state: &nu_protocol::engine::EngineState, - stack: &mut nu_protocol::engine::Stack, - call: &nu_protocol::ast::Call, - input: nu_protocol::PipelineData, - ) -> Result { + engine_state: &EngineState, + stack: &mut Stack, + call: &Call, + input: PipelineData, + ) -> Result { let head = call.head; let args = Arguments { columns: call.get_flag(engine_state, stack, "columns")?, diff --git a/crates/nu-command/src/path/expand.rs b/crates/nu-command/src/path/expand.rs index 0c2b81cd82..0bd6b2b6cf 100644 --- a/crates/nu-command/src/path/expand.rs +++ b/crates/nu-command/src/path/expand.rs @@ -3,6 +3,8 @@ use std::path::Path; use nu_engine::env::current_dir_str; use nu_engine::CallExt; use nu_path::{canonicalize_with, expand_path_with}; +use nu_protocol::ast::Call; +use nu_protocol::engine::{EngineState, Stack}; use nu_protocol::{ engine::Command, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value, }; @@ -53,11 +55,11 @@ impl Command for SubCommand { fn run( &self, - engine_state: &nu_protocol::engine::EngineState, - stack: &mut nu_protocol::engine::Stack, - call: &nu_protocol::ast::Call, - input: nu_protocol::PipelineData, - ) -> Result { + engine_state: &EngineState, + stack: &mut Stack, + call: &Call, + input: PipelineData, + ) -> Result { let head = call.head; let args = Arguments { strict: call.has_flag("strict"), diff --git a/crates/nu-command/src/path/join.rs b/crates/nu-command/src/path/join.rs index 021238c535..54bd97291a 100644 --- a/crates/nu-command/src/path/join.rs +++ b/crates/nu-command/src/path/join.rs @@ -4,6 +4,8 @@ use std::{ }; use nu_engine::CallExt; +use nu_protocol::ast::Call; +use nu_protocol::engine::{EngineState, Stack}; use nu_protocol::{ engine::Command, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Type, Value, @@ -57,9 +59,9 @@ the output of 'path parse' and 'path split' subcommands."# fn run( &self, - engine_state: &nu_protocol::engine::EngineState, - stack: &mut nu_protocol::engine::Stack, - call: &nu_protocol::ast::Call, + engine_state: &EngineState, + stack: &mut Stack, + call: &Call, input: PipelineData, ) -> Result { let head = call.head; diff --git a/crates/nu-command/src/path/parse.rs b/crates/nu-command/src/path/parse.rs index c36193d85e..a57de385d1 100644 --- a/crates/nu-command/src/path/parse.rs +++ b/crates/nu-command/src/path/parse.rs @@ -2,6 +2,8 @@ use std::path::Path; use indexmap::IndexMap; use nu_engine::CallExt; +use nu_protocol::ast::Call; +use nu_protocol::engine::{EngineState, Stack}; use nu_protocol::{ engine::Command, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Type, Value, @@ -56,11 +58,11 @@ On Windows, an extra 'prefix' column is added."# fn run( &self, - engine_state: &nu_protocol::engine::EngineState, - stack: &mut nu_protocol::engine::Stack, - call: &nu_protocol::ast::Call, - input: nu_protocol::PipelineData, - ) -> Result { + engine_state: &EngineState, + stack: &mut Stack, + call: &Call, + input: PipelineData, + ) -> Result { let head = call.head; let args = Arguments { columns: call.get_flag(engine_state, stack, "columns")?, diff --git a/crates/nu-command/src/path/path_.rs b/crates/nu-command/src/path/path_.rs index e68ec101c4..97c8b5197d 100644 --- a/crates/nu-command/src/path/path_.rs +++ b/crates/nu-command/src/path/path_.rs @@ -2,7 +2,7 @@ use nu_engine::get_full_help; use nu_protocol::{ ast::Call, engine::{Command, EngineState, Stack}, - IntoPipelineData, PipelineData, Signature, Type, Value, + IntoPipelineData, PipelineData, ShellError, Signature, Type, Value, }; #[derive(Clone)] @@ -23,7 +23,7 @@ impl Command for PathCommand { fn extra_usage(&self) -> &str { r#"You must use one of the following subcommands. Using this command as-is will only produce this help message. - + There are three ways to represent a path: * As a path literal, e.g., '/home/viking/spam.txt' @@ -44,7 +44,7 @@ the path literal."# stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(Value::String { val: get_full_help( &PathCommand.signature(), diff --git a/crates/nu-command/src/path/relative_to.rs b/crates/nu-command/src/path/relative_to.rs index 236a2f7ff2..e1f398997b 100644 --- a/crates/nu-command/src/path/relative_to.rs +++ b/crates/nu-command/src/path/relative_to.rs @@ -2,6 +2,8 @@ use std::path::Path; use nu_engine::CallExt; use nu_path::expand_to_real_path; +use nu_protocol::ast::Call; +use nu_protocol::engine::{EngineState, Stack}; use nu_protocol::{ engine::Command, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Type, Value, @@ -56,11 +58,11 @@ path."# fn run( &self, - engine_state: &nu_protocol::engine::EngineState, - stack: &mut nu_protocol::engine::Stack, - call: &nu_protocol::ast::Call, - input: nu_protocol::PipelineData, - ) -> Result { + engine_state: &EngineState, + stack: &mut Stack, + call: &Call, + input: PipelineData, + ) -> Result { let head = call.head; let args = Arguments { path: call.req(engine_state, stack, 0)?, diff --git a/crates/nu-command/src/path/split.rs b/crates/nu-command/src/path/split.rs index 677b529594..c1182eb234 100644 --- a/crates/nu-command/src/path/split.rs +++ b/crates/nu-command/src/path/split.rs @@ -1,6 +1,8 @@ use std::path::{Component, Path}; use nu_engine::CallExt; +use nu_protocol::ast::Call; +use nu_protocol::engine::{EngineState, Stack}; use nu_protocol::{ engine::Command, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value, }; @@ -42,11 +44,11 @@ impl Command for SubCommand { fn run( &self, - engine_state: &nu_protocol::engine::EngineState, - stack: &mut nu_protocol::engine::Stack, - call: &nu_protocol::ast::Call, - input: nu_protocol::PipelineData, - ) -> Result { + engine_state: &EngineState, + stack: &mut Stack, + call: &Call, + input: PipelineData, + ) -> Result { let head = call.head; let args = Arguments { columns: call.get_flag(engine_state, stack, "columns")?, diff --git a/crates/nu-command/src/path/type.rs b/crates/nu-command/src/path/type.rs index f270d065bf..5279b3d8ee 100644 --- a/crates/nu-command/src/path/type.rs +++ b/crates/nu-command/src/path/type.rs @@ -1,6 +1,8 @@ use std::path::Path; use nu_engine::CallExt; +use nu_protocol::ast::Call; +use nu_protocol::engine::{EngineState, Stack}; use nu_protocol::{ engine::Command, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value, }; @@ -47,11 +49,11 @@ If nothing is found, an empty string will be returned."# fn run( &self, - engine_state: &nu_protocol::engine::EngineState, - stack: &mut nu_protocol::engine::Stack, - call: &nu_protocol::ast::Call, - input: nu_protocol::PipelineData, - ) -> Result { + engine_state: &EngineState, + stack: &mut Stack, + call: &Call, + input: PipelineData, + ) -> Result { let head = call.head; let args = Arguments { columns: call.get_flag(engine_state, stack, "columns")?, diff --git a/crates/nu-command/src/platform/ansi/ansi_.rs b/crates/nu-command/src/platform/ansi/ansi_.rs index 2fad9f88e0..43cf1fe40b 100644 --- a/crates/nu-command/src/platform/ansi/ansi_.rs +++ b/crates/nu-command/src/platform/ansi/ansi_.rs @@ -1,5 +1,6 @@ use nu_ansi_term::*; use nu_engine::CallExt; +use nu_protocol::engine::{EngineState, Stack}; use nu_protocol::{ ast::Call, engine::Command, Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value, @@ -622,11 +623,11 @@ Format: # fn run( &self, - engine_state: &nu_protocol::engine::EngineState, - stack: &mut nu_protocol::engine::Stack, + engine_state: &EngineState, + stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { let list: bool = call.has_flag("list"); let escape: bool = call.has_flag("escape"); let osc: bool = call.has_flag("osc"); @@ -759,10 +760,10 @@ pub fn str_to_ansi(s: &str) -> Option { } fn generate_ansi_code_list( - engine_state: &nu_protocol::engine::EngineState, + engine_state: &EngineState, call_span: Span, use_ansi_coloring: bool, -) -> Result { +) -> Result { return Ok(CODE_LIST .iter() .enumerate() diff --git a/crates/nu-command/src/platform/ansi/gradient.rs b/crates/nu-command/src/platform/ansi/gradient.rs index fe40e5b8fb..696b625e38 100644 --- a/crates/nu-command/src/platform/ansi/gradient.rs +++ b/crates/nu-command/src/platform/ansi/gradient.rs @@ -63,7 +63,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { operate(engine_state, stack, call, input) } diff --git a/crates/nu-command/src/platform/ansi/link.rs b/crates/nu-command/src/platform/ansi/link.rs index f150fa1d7c..7b22f89503 100644 --- a/crates/nu-command/src/platform/ansi/link.rs +++ b/crates/nu-command/src/platform/ansi/link.rs @@ -30,7 +30,7 @@ impl Command for SubCommand { .named( "text", SyntaxShape::String, - "Link text. Uses uri as text if absent. In case of + "Link text. Uses uri as text if absent. In case of tables, records and lists applies this text to all elements", Some('t'), ) @@ -54,7 +54,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { operate(engine_state, stack, call, input) } diff --git a/crates/nu-command/src/platform/ansi/strip.rs b/crates/nu-command/src/platform/ansi/strip.rs index d08cbef802..d3846584eb 100644 --- a/crates/nu-command/src/platform/ansi/strip.rs +++ b/crates/nu-command/src/platform/ansi/strip.rs @@ -34,7 +34,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let cell_paths: Vec = call.rest(engine_state, stack, 0)?; let arg = CellPathOnlyArgs::from(cell_paths); operate(action, arg, input, call.head, engine_state.ctrlc.clone()) diff --git a/crates/nu-command/src/platform/reedline_commands/keybindings.rs b/crates/nu-command/src/platform/reedline_commands/keybindings.rs index 15c1160ba5..b3b796f73c 100644 --- a/crates/nu-command/src/platform/reedline_commands/keybindings.rs +++ b/crates/nu-command/src/platform/reedline_commands/keybindings.rs @@ -2,7 +2,7 @@ use nu_engine::get_full_help; use nu_protocol::{ ast::Call, engine::{Command, EngineState, Stack}, - Category, IntoPipelineData, PipelineData, Signature, Type, Value, + Category, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value, }; #[derive(Clone)] @@ -37,7 +37,7 @@ impl Command for Keybindings { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(Value::String { val: get_full_help( &Keybindings.signature(), diff --git a/crates/nu-command/src/platform/reedline_commands/keybindings_default.rs b/crates/nu-command/src/platform/reedline_commands/keybindings_default.rs index 6d9776dc68..139a35d1fe 100644 --- a/crates/nu-command/src/platform/reedline_commands/keybindings_default.rs +++ b/crates/nu-command/src/platform/reedline_commands/keybindings_default.rs @@ -1,7 +1,7 @@ use nu_protocol::{ ast::Call, engine::{Command, EngineState, Stack}, - Category, Example, IntoPipelineData, PipelineData, Signature, Type, Value, + Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value, }; use reedline::get_reedline_default_keybindings; @@ -37,7 +37,7 @@ impl Command for KeybindingsDefault { _stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { let records = get_reedline_default_keybindings() .into_iter() .map(|(mode, modifier, code, event)| { diff --git a/crates/nu-command/src/platform/reedline_commands/keybindings_list.rs b/crates/nu-command/src/platform/reedline_commands/keybindings_list.rs index b18eae58fd..b1ce07f433 100644 --- a/crates/nu-command/src/platform/reedline_commands/keybindings_list.rs +++ b/crates/nu-command/src/platform/reedline_commands/keybindings_list.rs @@ -1,7 +1,7 @@ use nu_protocol::{ ast::Call, engine::{Command, EngineState, Stack}, - Category, Example, IntoPipelineData, PipelineData, Signature, Span, Type, Value, + Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, Type, Value, }; use reedline::{ get_reedline_edit_commands, get_reedline_keybinding_modifiers, get_reedline_keycodes, @@ -57,7 +57,7 @@ impl Command for KeybindingsList { _stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { let records = if call.named_len() == 0 { let all_options = vec!["modifiers", "keycodes", "edits", "modes", "events"]; all_options diff --git a/crates/nu-command/src/platform/term_size.rs b/crates/nu-command/src/platform/term_size.rs index 1afb067272..0e2e5db31a 100644 --- a/crates/nu-command/src/platform/term_size.rs +++ b/crates/nu-command/src/platform/term_size.rs @@ -1,6 +1,8 @@ use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; -use nu_protocol::{Category, Example, IntoPipelineData, PipelineData, Signature, Type, Value}; +use nu_protocol::{ + Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value, +}; use terminal_size::{terminal_size, Height, Width}; #[derive(Clone)] @@ -53,7 +55,7 @@ impl Command for TermSize { _stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { let head = call.head; let (cols, rows) = match terminal_size() { diff --git a/crates/nu-command/src/random/bool.rs b/crates/nu-command/src/random/bool.rs index b53e79d799..a79d5aa8f5 100644 --- a/crates/nu-command/src/random/bool.rs +++ b/crates/nu-command/src/random/bool.rs @@ -41,7 +41,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { bool(engine_state, stack, call) } diff --git a/crates/nu-command/src/random/chars.rs b/crates/nu-command/src/random/chars.rs index df0a340781..b16f831873 100644 --- a/crates/nu-command/src/random/chars.rs +++ b/crates/nu-command/src/random/chars.rs @@ -41,7 +41,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { chars(engine_state, stack, call) } diff --git a/crates/nu-command/src/random/decimal.rs b/crates/nu-command/src/random/decimal.rs index 78dd6d7c94..fe366b3d19 100644 --- a/crates/nu-command/src/random/decimal.rs +++ b/crates/nu-command/src/random/decimal.rs @@ -37,7 +37,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { decimal(engine_state, stack, call) } diff --git a/crates/nu-command/src/random/dice.rs b/crates/nu-command/src/random/dice.rs index b3bbdddd5d..895779650a 100644 --- a/crates/nu-command/src/random/dice.rs +++ b/crates/nu-command/src/random/dice.rs @@ -47,7 +47,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { dice(engine_state, stack, call) } diff --git a/crates/nu-command/src/random/integer.rs b/crates/nu-command/src/random/integer.rs index afdb4fb9ae..1949e85d2b 100644 --- a/crates/nu-command/src/random/integer.rs +++ b/crates/nu-command/src/random/integer.rs @@ -37,7 +37,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { integer(engine_state, stack, call) } diff --git a/crates/nu-command/src/random/random_.rs b/crates/nu-command/src/random/random_.rs index 3f527cf36a..b24c2ba28f 100644 --- a/crates/nu-command/src/random/random_.rs +++ b/crates/nu-command/src/random/random_.rs @@ -2,7 +2,7 @@ use nu_engine::get_full_help; use nu_protocol::{ ast::Call, engine::{Command, EngineState, Stack}, - Category, IntoPipelineData, PipelineData, Signature, Type, Value, + Category, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value, }; #[derive(Clone)] @@ -37,7 +37,7 @@ impl Command for RandomCommand { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(Value::String { val: get_full_help( &RandomCommand.signature(), diff --git a/crates/nu-command/src/random/uuid.rs b/crates/nu-command/src/random/uuid.rs index b0b6d39e51..dee946a5a0 100644 --- a/crates/nu-command/src/random/uuid.rs +++ b/crates/nu-command/src/random/uuid.rs @@ -32,7 +32,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { uuid(call) } diff --git a/crates/nu-command/src/strings/char_.rs b/crates/nu-command/src/strings/char_.rs index df4b8ed111..9fa9250b7b 100644 --- a/crates/nu-command/src/strings/char_.rs +++ b/crates/nu-command/src/strings/char_.rs @@ -1,6 +1,7 @@ use indexmap::indexmap; use indexmap::map::IndexMap; use nu_engine::CallExt; +use nu_protocol::engine::{EngineState, Stack}; use nu_protocol::{ ast::Call, engine::Command, Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value, @@ -211,11 +212,11 @@ impl Command for Char { fn run( &self, - engine_state: &nu_protocol::engine::EngineState, - stack: &mut nu_protocol::engine::Stack, + engine_state: &EngineState, + stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { let call_span = call.head; // handle -l flag if call.has_flag("list") { diff --git a/crates/nu-command/src/strings/split/chars.rs b/crates/nu-command/src/strings/split/chars.rs index 4c7a95c57b..bceff10cad 100644 --- a/crates/nu-command/src/strings/split/chars.rs +++ b/crates/nu-command/src/strings/split/chars.rs @@ -72,7 +72,7 @@ impl Command for SubCommand { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { split_chars(engine_state, call, input) } } @@ -81,7 +81,7 @@ fn split_chars( engine_state: &EngineState, call: &Call, input: PipelineData, -) -> Result { +) -> Result { let span = call.head; let graphemes = grapheme_flags(call)?; diff --git a/crates/nu-command/src/strings/split/column.rs b/crates/nu-command/src/strings/split/column.rs index 735c17d7af..ab45d66c80 100644 --- a/crates/nu-command/src/strings/split/column.rs +++ b/crates/nu-command/src/strings/split/column.rs @@ -52,7 +52,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { split_column(engine_state, stack, call, input) } @@ -126,7 +126,7 @@ fn split_column( stack: &mut Stack, call: &Call, input: PipelineData, -) -> Result { +) -> Result { let name_span = call.head; let separator: Spanned = call.req(engine_state, stack, 0)?; let rest: Vec> = call.rest(engine_state, stack, 1)?; diff --git a/crates/nu-command/src/strings/split/command.rs b/crates/nu-command/src/strings/split/command.rs index 065319c108..f6a96a50d2 100644 --- a/crates/nu-command/src/strings/split/command.rs +++ b/crates/nu-command/src/strings/split/command.rs @@ -2,7 +2,7 @@ use nu_engine::get_full_help; use nu_protocol::{ ast::Call, engine::{Command, EngineState, Stack}, - Category, IntoPipelineData, PipelineData, Signature, Type, Value, + Category, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value, }; #[derive(Clone)] @@ -33,7 +33,7 @@ impl Command for SplitCommand { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(Value::String { val: get_full_help( &SplitCommand.signature(), diff --git a/crates/nu-command/src/strings/split/list.rs b/crates/nu-command/src/strings/split/list.rs index ca1a98707b..80fd5ca020 100644 --- a/crates/nu-command/src/strings/split/list.rs +++ b/crates/nu-command/src/strings/split/list.rs @@ -2,7 +2,8 @@ use nu_engine::CallExt; use nu_protocol::{ ast::Call, engine::{Command, EngineState, Stack}, - Category, Example, IntoPipelineData, PipelineData, Signature, Span, SyntaxShape, Type, Value, + Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, SyntaxShape, + Type, Value, }; #[derive(Clone)] @@ -41,7 +42,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { split_list(engine_state, stack, call, input) } @@ -129,7 +130,7 @@ fn split_list( stack: &mut Stack, call: &Call, input: PipelineData, -) -> Result { +) -> Result { let separator: Value = call.req(engine_state, stack, 0)?; let mut temp_list = Vec::new(); let mut returned_list = Vec::new(); diff --git a/crates/nu-command/src/strings/split/row.rs b/crates/nu-command/src/strings/split/row.rs index 45b1f30acd..61fc9fae1e 100644 --- a/crates/nu-command/src/strings/split/row.rs +++ b/crates/nu-command/src/strings/split/row.rs @@ -46,7 +46,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { split_row(engine_state, stack, call, input) } @@ -101,7 +101,7 @@ fn split_row( stack: &mut Stack, call: &Call, input: PipelineData, -) -> Result { +) -> Result { let name_span = call.head; let separator: Spanned = call.req(engine_state, stack, 0)?; let max_split: Option = call.get_flag(engine_state, stack, "number")?; diff --git a/crates/nu-command/src/strings/split/words.rs b/crates/nu-command/src/strings/split/words.rs index 9291bf7471..58b9d8684b 100644 --- a/crates/nu-command/src/strings/split/words.rs +++ b/crates/nu-command/src/strings/split/words.rs @@ -100,7 +100,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { split_words(engine_state, stack, call, input) } } @@ -110,7 +110,7 @@ fn split_words( stack: &mut Stack, call: &Call, input: PipelineData, -) -> Result { +) -> Result { let span = call.head; // let ignore_hyphenated = call.has_flag("ignore-hyphenated"); // let ignore_apostrophes = call.has_flag("ignore-apostrophes"); diff --git a/crates/nu-command/src/strings/str_/case/str_.rs b/crates/nu-command/src/strings/str_/case/str_.rs index bf806c0eef..6f86c5c644 100644 --- a/crates/nu-command/src/strings/str_/case/str_.rs +++ b/crates/nu-command/src/strings/str_/case/str_.rs @@ -2,7 +2,7 @@ use nu_engine::get_full_help; use nu_protocol::{ ast::Call, engine::{Command, EngineState, Stack}, - Category, IntoPipelineData, PipelineData, Signature, Type, Value, + Category, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value, }; #[derive(Clone)] @@ -33,7 +33,7 @@ impl Command for Str { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(Value::String { val: get_full_help( &Str.signature(), diff --git a/crates/nu-command/src/strings/str_/trim/trim_.rs b/crates/nu-command/src/strings/str_/trim/trim_.rs index e32d367f74..863af7407c 100644 --- a/crates/nu-command/src/strings/str_/trim/trim_.rs +++ b/crates/nu-command/src/strings/str_/trim/trim_.rs @@ -83,7 +83,7 @@ impl Command for SubCommand { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let character = call.get_flag::>(engine_state, stack, "char")?; let to_trim = match character.as_ref() { Some(v) => { diff --git a/crates/nu-command/src/system/benchmark.rs b/crates/nu-command/src/system/benchmark.rs index 8b9645a04d..d9ba5e2c75 100644 --- a/crates/nu-command/src/system/benchmark.rs +++ b/crates/nu-command/src/system/benchmark.rs @@ -4,7 +4,8 @@ use nu_engine::{eval_block, CallExt}; use nu_protocol::ast::Call; use nu_protocol::engine::{Closure, Command, EngineState, Stack}; use nu_protocol::{ - Category, Example, IntoPipelineData, PipelineData, Signature, SyntaxShape, Type, Value, + Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, SyntaxShape, Type, + Value, }; #[derive(Clone)] @@ -40,7 +41,7 @@ impl Command for Benchmark { stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let capture_block: Closure = call.req(engine_state, stack, 0)?; let block = engine_state.get_block(capture_block.block_id); diff --git a/crates/nu-command/src/system/complete.rs b/crates/nu-command/src/system/complete.rs index a78b69bf53..511f352a57 100644 --- a/crates/nu-command/src/system/complete.rs +++ b/crates/nu-command/src/system/complete.rs @@ -34,7 +34,7 @@ impl Command for Complete { _stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { match input { PipelineData::ExternalStream { stdout, diff --git a/crates/nu-command/src/system/exec.rs b/crates/nu-command/src/system/exec.rs index 4fc206abcd..acf845f8f4 100644 --- a/crates/nu-command/src/system/exec.rs +++ b/crates/nu-command/src/system/exec.rs @@ -37,7 +37,7 @@ impl Command for Exec { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { exec(engine_state, stack, call) } @@ -61,7 +61,7 @@ fn exec( engine_state: &EngineState, stack: &mut Stack, call: &Call, -) -> Result { +) -> Result { let name: Spanned = call.req(engine_state, stack, 0)?; let name_span = name.span; diff --git a/crates/nu-command/src/system/ps.rs b/crates/nu-command/src/system/ps.rs index 74fa48e3ca..5ebf21b3b9 100644 --- a/crates/nu-command/src/system/ps.rs +++ b/crates/nu-command/src/system/ps.rs @@ -41,7 +41,7 @@ impl Command for Ps { _stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { run_ps(engine_state, call) } diff --git a/crates/nu-command/src/system/registry_query.rs b/crates/nu-command/src/system/registry_query.rs index bee63f66e2..3d38749aa7 100644 --- a/crates/nu-command/src/system/registry_query.rs +++ b/crates/nu-command/src/system/registry_query.rs @@ -69,7 +69,7 @@ impl Command for RegistryQuery { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { registry_query(engine_state, stack, call) } @@ -93,7 +93,7 @@ fn registry_query( engine_state: &EngineState, stack: &mut Stack, call: &Call, -) -> Result { +) -> Result { let call_span = call.head; let registry_key: Spanned = call.req(engine_state, stack, 0)?; diff --git a/crates/nu-command/src/system/sys.rs b/crates/nu-command/src/system/sys.rs index 212f4e7895..2ad738b1ae 100644 --- a/crates/nu-command/src/system/sys.rs +++ b/crates/nu-command/src/system/sys.rs @@ -33,7 +33,7 @@ impl Command for Sys { _stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { run_sys(call) } diff --git a/crates/nu-command/src/system/which_.rs b/crates/nu-command/src/system/which_.rs index 0d0fd892a1..5758506d93 100644 --- a/crates/nu-command/src/system/which_.rs +++ b/crates/nu-command/src/system/which_.rs @@ -44,7 +44,7 @@ impl Command for Which { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { which(engine_state, stack, call) } diff --git a/crates/nu-command/src/viewers/griddle.rs b/crates/nu-command/src/viewers/griddle.rs index 9d0b44d044..9c50c22c74 100644 --- a/crates/nu-command/src/viewers/griddle.rs +++ b/crates/nu-command/src/viewers/griddle.rs @@ -62,7 +62,7 @@ prints out the list properly."# stack: &mut Stack, call: &Call, input: PipelineData, - ) -> Result { + ) -> Result { let width_param: Option = call.get_flag(engine_state, stack, "width")?; let color_param: bool = call.has_flag("color"); let separator_param: Option = call.get_flag(engine_state, stack, "separator")?; diff --git a/crates/nu-command/src/viewers/table.rs b/crates/nu-command/src/viewers/table.rs index 048a6768c4..70225e683f 100644 --- a/crates/nu-command/src/viewers/table.rs +++ b/crates/nu-command/src/viewers/table.rs @@ -613,7 +613,7 @@ fn handle_row_stream( row_offset: usize, ctrlc: Option>, metadata: Option, -) -> Result { +) -> Result { let stream = match metadata { // First, `ls` sources: Some(PipelineMetadata { diff --git a/crates/nu-command/tests/commands/random/uuid.rs b/crates/nu-command/tests/commands/random/uuid.rs index 725081383c..c0b5559221 100644 --- a/crates/nu-command/tests/commands/random/uuid.rs +++ b/crates/nu-command/tests/commands/random/uuid.rs @@ -1,4 +1,4 @@ -use nu_test_support::{nu, pipeline}; +use nu_test_support::nu; use uuid_crate::Uuid; #[test] diff --git a/crates/nu-parser/tests/test_parser.rs b/crates/nu-parser/tests/test_parser.rs index 97e9ec4b3e..c266fcb02e 100644 --- a/crates/nu-parser/tests/test_parser.rs +++ b/crates/nu-parser/tests/test_parser.rs @@ -1,9 +1,10 @@ use nu_parser::ParseError; use nu_parser::*; +use nu_protocol::ast::Call; use nu_protocol::{ ast::{Expr, Expression, PipelineElement}, engine::{Command, EngineState, Stack, StateWorkingSet}, - Signature, SyntaxShape, + PipelineData, ShellError, Signature, SyntaxShape, }; #[cfg(test)] @@ -34,9 +35,9 @@ impl Command for Let { &self, _engine_state: &EngineState, _stack: &mut Stack, - _call: &nu_protocol::ast::Call, - _input: nu_protocol::PipelineData, - ) -> Result { + _call: &Call, + _input: PipelineData, + ) -> Result { todo!() } } @@ -955,7 +956,8 @@ mod range { #[cfg(test)] mod input_types { use super::*; - use nu_protocol::{ast::Argument, Category, Type}; + use nu_protocol::ast::Call; + use nu_protocol::{ast::Argument, Category, PipelineData, ShellError, Type}; #[derive(Clone)] pub struct LsTest; @@ -977,9 +979,9 @@ mod input_types { &self, _engine_state: &EngineState, _stack: &mut Stack, - _call: &nu_protocol::ast::Call, - _input: nu_protocol::PipelineData, - ) -> Result { + _call: &Call, + _input: PipelineData, + ) -> Result { todo!() } } @@ -1006,9 +1008,9 @@ mod input_types { &self, _engine_state: &EngineState, _stack: &mut Stack, - _call: &nu_protocol::ast::Call, - _input: nu_protocol::PipelineData, - ) -> Result { + _call: &Call, + _input: PipelineData, + ) -> Result { todo!() } } @@ -1036,9 +1038,9 @@ mod input_types { &self, _engine_state: &EngineState, _stack: &mut Stack, - _call: &nu_protocol::ast::Call, - _input: nu_protocol::PipelineData, - ) -> Result { + _call: &Call, + _input: PipelineData, + ) -> Result { todo!() } } @@ -1068,9 +1070,9 @@ mod input_types { &self, _engine_state: &EngineState, _stack: &mut Stack, - _call: &nu_protocol::ast::Call, - _input: nu_protocol::PipelineData, - ) -> Result { + _call: &Call, + _input: PipelineData, + ) -> Result { todo!() } } @@ -1098,9 +1100,9 @@ mod input_types { &self, _engine_state: &EngineState, _stack: &mut Stack, - _call: &nu_protocol::ast::Call, - _input: nu_protocol::PipelineData, - ) -> Result { + _call: &Call, + _input: PipelineData, + ) -> Result { todo!() } } @@ -1125,9 +1127,9 @@ mod input_types { &self, _engine_state: &EngineState, _stack: &mut Stack, - _call: &nu_protocol::ast::Call, - _input: nu_protocol::PipelineData, - ) -> Result { + _call: &Call, + _input: PipelineData, + ) -> Result { todo!() } } @@ -1156,9 +1158,9 @@ mod input_types { &self, _engine_state: &EngineState, _stack: &mut Stack, - _call: &nu_protocol::ast::Call, - _input: nu_protocol::PipelineData, - ) -> Result { + _call: &Call, + _input: PipelineData, + ) -> Result { todo!() } } @@ -1186,9 +1188,9 @@ mod input_types { &self, _engine_state: &EngineState, _stack: &mut Stack, - _call: &nu_protocol::ast::Call, - _input: nu_protocol::PipelineData, - ) -> Result { + _call: &Call, + _input: PipelineData, + ) -> Result { todo!() } } @@ -1225,9 +1227,9 @@ mod input_types { &self, _engine_state: &EngineState, _stack: &mut Stack, - _call: &nu_protocol::ast::Call, - _input: nu_protocol::PipelineData, - ) -> Result { + _call: &Call, + _input: PipelineData, + ) -> Result { todo!() } } diff --git a/src/command.rs b/src/command.rs index 59660c06ed..68ade3b2bc 100644 --- a/src/command.rs +++ b/src/command.rs @@ -321,7 +321,7 @@ impl Command for Nu { stack: &mut Stack, call: &Call, _input: PipelineData, - ) -> Result { + ) -> Result { Ok(Value::String { val: get_full_help(&Nu.signature(), &Nu.examples(), engine_state, stack, true), span: call.head,