Skip to content

Commit

Permalink
null-stream.nu as stdlib-candidate (#649)
Browse files Browse the repository at this point in the history
This is a way to redirect to a null stream with the same syntax
regardless of platform.
  • Loading branch information
Hullabaloo-and-Howdy-Do committed Oct 23, 2023
1 parent 7b2856d commit 2fa5caa
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions stdlib-candidate/null-stream.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Examples
# redirect to the null stream
# > echo foo out> (null-stream)
def null-stream []: nothing -> string {
if $nu.os-info.name == "windows" {
"NUL:"
} else {
"/dev/null"
}
}

0 comments on commit 2fa5caa

Please sign in to comment.