From aa08e813703771ed530777c765eb91707530f646 Mon Sep 17 00:00:00 2001 From: Antoine Stevan <44101798+amtoine@users.noreply.github.com> Date: Thu, 27 Jul 2023 21:39:03 +0200 Subject: [PATCH] change signature of `enumerate` to `any -> table` (#9822) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit related to https://discord.com/channels/601130461678272522/1134054657086464072 # Description the `enumerate` command always returns a table but its signature is `any -> any` which can be confusing :confused: this PR changes the signature to `any -> table` i've double checked and the source of `enumerate` returns a list of records, a.k.a. a table :ok_hand: # User-Facing Changes this shouldn't change anything apart from the help page of `enumerate` showing now ``` Input/output types: ╭───┬───────┬────────╮ │ # │ input │ output │ ├───┼───────┼────────┤ │ 0 │ any │ table │ ╰───┴───────┴────────╯ ``` instead of ``` Input/output types: ╭───┬───────┬────────╮ │ # │ input │ output │ ├───┼───────┼────────┤ │ 0 │ any │ any │ ╰───┴───────┴────────╯ ``` # Tests + Formatting - :green_circle: `toolkit fmt` - :green_circle: `toolkit clippy` - :black_circle: `toolkit test` - :black_circle: `toolkit test stdlib` # After Submitting --- crates/nu-command/src/filters/enumerate.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/nu-command/src/filters/enumerate.rs b/crates/nu-command/src/filters/enumerate.rs index ee94efa7be..df258ca7cd 100644 --- a/crates/nu-command/src/filters/enumerate.rs +++ b/crates/nu-command/src/filters/enumerate.rs @@ -23,7 +23,7 @@ impl Command for Enumerate { fn signature(&self) -> nu_protocol::Signature { Signature::build("enumerate") - .input_output_types(vec![(Type::Any, Type::Any)]) + .input_output_types(vec![(Type::Any, Type::Table(vec![]))]) .category(Category::Filters) }