Rename/deprecate range to slice (#14825)

# Description
As the `range` command has an ambiguous name (does it construct a range
type?, does it iterate a range like `seq`) replace it with a more
descriptive verb of what it does: `slice`

Closes #14130
# User-Facing Changes
`range` is now deprecated and replaced in whole by `slice` with the same
behavior.
`range` will be removed in `0.103.0`

# Tests + Formatting
Tests have been updated to use `slice`

# After submitting

- [ ] prepare PR for `nu_scripts` (several usages of `range` to be
fixed)
- [ ] update documentation usages of `range` after release
This commit is contained in:
Stefan Holderbach
2025-01-17 13:21:32 +01:00
committed by GitHub
parent 089c5221cc
commit 4dcaf2a201
7 changed files with 167 additions and 74 deletions

View File

@ -441,7 +441,7 @@ fn better_operator_spans() -> TestResult {
#[test]
fn range_right_exclusive() -> TestResult {
run_test(r#"[1, 4, 5, 8, 9] | range 1..<3 | math sum"#, "9")
run_test(r#"[1, 4, 5, 8, 9] | slice 1..<3 | math sum"#, "9")
}
/// Issue #7872