mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 14:40:06 +02:00
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:
@ -110,15 +110,18 @@ export def repeat [
|
||||
1..$n | each { $item }
|
||||
}
|
||||
|
||||
# null device file
|
||||
export const null_device = if $nu.os-info.name == "windows" {
|
||||
'\\.\NUL'
|
||||
} else {
|
||||
'/dev/null'
|
||||
}
|
||||
|
||||
# return a null device file.
|
||||
#
|
||||
# # Examples
|
||||
# run a command and ignore it's stderr output
|
||||
# > cat xxx.txt e> (null-device)
|
||||
export def null-device []: nothing -> path {
|
||||
if ($nu.os-info.name | str downcase) == "windows" {
|
||||
'\\.\NUL'
|
||||
} else {
|
||||
"/dev/null"
|
||||
}
|
||||
$null_device
|
||||
}
|
||||
|
Reference in New Issue
Block a user