Repository: nushell/nushell
File: crates/nu-command/src/filters/where_.rs (Rust)

Code before:
use nu_engine::{command_prelude::*, ClosureEval};
use nu_protocol::engine::{Closure, CommandType};

#[derive(Clone)]
pub struct Where;

impl Command for Where {
    fn name(&self) -> &str {
        "where"
    }

    fn description(&self) -> &str {
        "Filter values of an input list based on a condition."
    }

    fn extra_description(&self) -> &str {
        r#"A condition is evaluated for each element of the input, and only elements which meet the condition are included in the output.

A condition can be either a "row condition", or a closure. A row condition is a special short-hand syntax to makes accessing fields easier.
Each element of the input can be accessed through the $it variable.

On the left hand side of a row condition, any field name is automatically expanded to use $it.
For example, where type == dir is equivalent to where $it.type == dir. This expansion does not happen when passing a subexpression or closure to where.

When using a closure, the element is passed as an argument and as pipeline input to the closure.

While where supports closure literals, they can not be read from a variable. To filter using a closure stored in a variable, use the filter command."#
    }

    fn command_type(&self) -> CommandType {
        CommandType::Keyword
    }

    fn signature(&self) -> nu_protocol::Signature {
        Signature::build("where")
            .input_output_types(vec![
                (
                    Type::List(Box::new(Type::Any)),
                    Type::List(Box::new(Type::Any)),
                ),
                (Type::table(), Type::table()),
                (Type::Range, Type::Any),
            ])
            .required(

Review comment (suggestion):
```suggestion
A condition can be either a "row condition" (a special short-hand syntax which simplifies field access) or a closure.
```

Code after:
use nu_engine::{ClosureEval, command_prelude::*};
use nu_protocol::engine::{Closure, CommandType};

#[derive(Clone)]
pub struct Where;

impl Command for Where {
    fn name(&self) -> &str {
        "where"
    }

    fn description(&self) -> &str {
        "Filter values of an input list based on a condition."
    }

    fn extra_description(&self) -> &str {
        r#"A condition is evaluated for each element of the input, and only elements which meet the condition are included in the output.

A condition can be either a "row condition" or a closure. A row condition is a special short-hand syntax to makes accessing fields easier.
Each element of the input can be accessed through the `$it` variable.

On the left hand side of a row condition, any field name is automatically expanded to use `$it`.
For example, `where type == dir` is equivalent to `where $it.type == dir`. This expansion does not happen when passing a subexpression or closure to `where`.

When using a closure, the element is passed as an argument and as pipeline input (`$in`) to the closure. Unlike row conditions, the `$it` variable isn't available inside closures.

Row conditions cannot be stored in a variable. To pass a condition with a variable, use a closure instead."#
    }

    fn command_type(&self) -> CommandType {
        CommandType::Keyword
    }

    fn signature(&self) -> nu_protocol::Signature {
        Signature::build("where")
            .input_output_types(vec![
                (
                    Type::List(Box::new(Type::Any)),
                    Type::List(Box::new(Type::Any)),
                ),
                (Type::table(), Type::table()),
                (Type::Range, Type::Any),
            ])
            .required(