shlax/demo.py
2021-11-12 13:27:24 +01:00

27 lines
579 B
Python

import asyncio
from shlax import Subprocess
async def main():
colors = {
'^(.*).txt$': '{green}\\1.txt',
'^(.*).py$': '{bred}\\1.py',
}
await asyncio.gather(
Subprocess(
'sh', '-euc',
'for i in $(find .. | head); do echo $i; sleep .2; done',
regexps=colors,
prefix='parent',
).wait(),
Subprocess(
'sh -euc "for i in $(find . | head); do echo $i; sleep .3; done"',
regexps=colors,
prefix='cwd',
).wait()
)
asyncio.run(main())