small, backwards compatible enhancements to std (#14763)

# Description
Small, backwards compatible enhancements to the standard library.

# User-Facing Changes

- changed `iter find`, `iter find-index`: Only consume the input stream
up to the first match.
- added `log set-level`: a small convenience command for setting the log
level
- added `$null_device`: `null-device` as a const variable, would allow
conditional sourcing if #13872 is fixed

# Tests + Formatting

- 🟢 toolkit fmt
- 🟢 toolkit clippy
- 🟢 toolkit test
- 🟢 toolkit test stdlib

# After Submitting
N/A
This commit is contained in:
Bahex
2025-01-06 20:30:07 +03:00
committed by GitHub
parent b60f91f722
commit ebabca575c
4 changed files with 44 additions and 51 deletions

View File

@ -313,3 +313,13 @@ export def custom [
|it, acc| $acc | str replace --all $it.0 $it.1
})
}
def "nu-complete log-level" [] {
log-level | transpose description value
}
# Change logging level
export def --env set-level [level: int@"nu-complete log-level"] {
# Keep it as a string so it can be passed to child processes
$env.NU_LOG_LEVEL = $level | into string
}