Initial commit

This commit is contained in:
Leon Mika 2023-04-24 01:29:54 +00:00
commit 19446235e0
5 changed files with 126 additions and 0 deletions

19
fmt.go Normal file
View file

@ -0,0 +1,19 @@
package scriptx
import (
"fmt"
"io"
)
func Printf(ptrn string) func(r io.Reader, w io.Writer) error {
return func(r io.Reader, w io.Writer) error {
return eachLine(r, func(line string) error {
_, err := io.WriteString(w, fmt.Sprintf(ptrn, line))
if err != nil {
return err
}
_, err = w.Write([]byte{'\n'})
return err
})
}
}