feat: add rust-script

This commit is contained in:
2022-08-06 01:14:04 +08:00
parent 70f202e982
commit a65b8f0aae
67 changed files with 5086 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
#!/bin/sh
set -e -u
echo "First:"
echo "line1\nline2" | rust-script --loop \
"let mut n=0; move |l| {n+=1; println!(\"{:>6}: {}\",n,l.trim_right())}"
echo "Second:"
echo "line1\nline2" | rust-script --count --loop \
"|l,n| println!(\"{:>6}: {}\", n, l.trim_right())"