tmuxp icon indicating copy to clipboard operation
tmuxp copied to clipboard

asyncio

Open tony opened this issue 3 years ago • 0 comments

After adding sleep_after / sleep_before in #750 we need a way to sleep asynchronously

Example from this convo: https://github.com/pallets/click/issues/85#issuecomment-503464628

import asyncio
from functools import wraps

def coro(f):
    @wraps(f)
    def wrapper(*args, **kwargs):
        return asyncio.run(f(*args, **kwargs))

    return wrapper

Usage:

@click.command()
@coro
async def command():
    await asyncio.sleep(1)
    click.echo("Delayed hello")

tony avatar Mar 15 '22 03:03 tony