add case-insensitive example to where (#10299)

related to
-
https://discord.com/channels/601130461678272522/614593951969574961/1150395064292495400

# Description
two cool things about the `where` command
- it's versatile enough to allow creating a case-insensitive version of
itself
- it does not require the explicit use of a closure

this PR adds an example showing how to filter with `where` but
case-insensitively and without an explicite closure.

# User-Facing Changes
new example to `where`:
```nushell
  Find case-insensitively files called "readme", without an explicit closure
  > ls | where ($it.name | str downcase) =~ readme
```

# Tests + Formatting
the new example test above.

# After Submitting
This commit is contained in:
Antoine Stevan 2023-09-10 22:24:38 +02:00 committed by GitHub
parent 762fdb98ac
commit fa40740e77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -152,6 +152,18 @@ not supported."#
example: "ls | where type == file | sort-by name -n | enumerate | where {|e| $e.item.name !~ $'^($e.index + 1)' } | each {|| get item }", example: "ls | where type == file | sort-by name -n | enumerate | where {|e| $e.item.name !~ $'^($e.index + 1)' } | each {|| get item }",
result: None, result: None,
}, },
Example {
description: r#"Find case-insensitively files called "readme", without an explicit closure"#,
example: "ls | where ($it.name | str downcase) =~ readme",
result: None,
},
Example {
description: "same as above but with regex only",
example: "ls | where name =~ '(?i)readme'",
result: None,
}
] ]
} }
} }