Skip to content

Instantly share code, notes, and snippets.

@devyn
Last active February 29, 2024 02:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devyn/7f75b04549fbcfb7255b1c493974b2bb to your computer and use it in GitHub Desktop.
Save devyn/7f75b04549fbcfb7255b1c493974b2bb to your computer and use it in GitHub Desktop.
demos from presentation at nushell core team meeting
# stream plugin
stream_example seq 1 10
stream_example seq 1 10 | describe
seq 1 10 | stream_example sum
stream_example seq 1 10000 | stream_example sum
[foo bar baz] | stream_example collect
[foo bar baz] | stream_example collect | describe
# engine calls (wip)
seq 1 5 | stream_example for-each { $in * 2 }
# basic tee
seq 1 100 | tee { save -f numbers.txt } | math sum
# capture stderr tee
do { nu --log-level trace -c 'print 5' } | tee -e { lines | find perf | save -f perf.log.txt }
# see plugin protocol
do { nu --log-level trace -c 'seq 1 5 | stream_example for-each { $in * 2 }' } | tee -e { lines | find plugin | save -f plugin.log.txt }
# interleave
seq 1 50 | wrap a | interleave { seq 1 50 | wrap b }
(
interleave
{ ^find . -name '*.md' | lines | each { "md: " ++ $in } }
{ ^find . -name '*.toml' | lines | each { "toml: " ++ $in } } |
to text
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment