Changed sub-pipe to return the line

This commit is contained in:
Leon Mika 2023-04-27 23:30:47 +00:00
parent 405bf812ee
commit 19f092b899
2 changed files with 4 additions and 4 deletions

View file

@ -17,11 +17,11 @@ func eachLine(r io.Reader, fn func(line string) error) error {
return scanner.Err()
}
func SubPipe(fn func(src *script.Pipe) *script.Pipe) func(r io.Reader, w io.Writer) error {
func SubPipe(fn func(line string) *script.Pipe) func(r io.Reader, w io.Writer) error {
return func(r io.Reader, w io.Writer) error {
scanner := bufio.NewScanner(r)
for scanner.Scan() {
bts, err := fn(script.Echo(scanner.Text())).Bytes()
bts, err := fn(scanner.Text()).Bytes()
if err != nil {
return err
}