Change all --insensitive flags to --ignore-case (#7198)

# Description

Support for this breaking change was raised in #7191. This affects
`sort`, `sort-by`, `str contains` and `find`. `--ignore-case` is used by
a few POSIX programs such as `less` and `grep`, as well as a few other
popular utils like `tree` and `wget`. Since long names aren't especially
popular (existing primarily for self-documentation purposes), I consider
this on the shallow end of the compat-break scale.

Note that the `-i` short flag is not affected.
 
# User-Facing Changes

See above.

# 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 --features=extra -- -D warnings -D
clippy::unwrap_used -A clippy::needless_collect` to check that you're
using the standard code style
- `cargo test --workspace --features=extra` 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.
This commit is contained in:
Leon
2022-11-23 07:38:30 +10:00
committed by GitHub
parent 74a73f9838
commit bb0b0870ea
5 changed files with 12 additions and 12 deletions

View File

@ -37,7 +37,7 @@ impl Command for SubCommand {
SyntaxShape::CellPath,
"For a data structure input, check strings at the given cell paths, and replace with result",
)
.switch("insensitive", "search is case insensitive", Some('i'))
.switch("ignore-case", "search is case insensitive", Some('i'))
.switch("not", "does not contain", Some('n'))
.category(Category::Strings)
}
@ -62,7 +62,7 @@ impl Command for SubCommand {
let args = Arguments {
substring: call.req::<String>(engine_state, stack, 0)?,
cell_paths,
case_insensitive: call.has_flag("insensitive"),
case_insensitive: call.has_flag("ignore-case"),
not_contain: call.has_flag("not"),
};
operate(action, args, input, call.head, engine_state.ctrlc.clone())