Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def make_cli(streams=None):
@asyncio.coroutine
def say_hello(reader, writer, name=None):
data = "Hello {}!".format(name) if name else "Hello!"
writer.write(data.encode() + b'\n')
parser = argparse.ArgumentParser(description="Say hello")
parser.add_argument('--name', '-n', type=str)
commands = {'hello': (say_hello, parser)}
return AsynchronousCli(commands, streams, prog='hello')
def make_cli(streams=None):
parser = argparse.ArgumentParser(description="Display the message history")
parser.add_argument('--pattern', '-p', type=str,
help='pattern to filter hostnames')
commands = {'history': (get_history, parser)}
return AsynchronousCli(commands, streams, prog='echo')