Skip to content

Commit

Permalink
docs: mention pipe split feature
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Oct 2, 2024
1 parent 666b202 commit bffb6ef
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const p = $`echo "5\\n3\\n1\\n4\\n2"`
const sorted = $({input: p})`sort` // 1\n2\n3\n4\n5
```

- [x] Pipe as literal
- [x] Pipe literals
```ts
const result = $`echo "5\\n3\\n1\\n4\\n2"`

Expand All @@ -84,6 +84,21 @@ const piped2 = (await result).pipe`sort`
const piped3 = result.pipe($`sort`)
```

- [x] Pipe splitting
```ts
const result = $`echo 1; sleep 1; echo 2; sleep 1; echo 3`
const piped1 = result.pipe`cat`
let piped2: any

setTimeout(() => {
piped2 = result.pipe`cat`
}, 1500)

await piped1
assert.equal((await piped1).toString(), '1\n2\n3')
assert.equal((await piped2).toString(), '1\n2\n3')
```

- [x] Presets
```ts
const $$ = $({sync: true, cmd: 'echo foo'})
Expand Down

0 comments on commit bffb6ef

Please sign in to comment.