How to use the aioconsole.server.parse_server function in aioconsole

To help you get started, we’ve selected a few aioconsole examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vxgmichel / aioconsole / aioconsole / apython.py View on Github external
# Extra arguments

    parser.add_argument(
        'args', metavar='ARGS', nargs=argparse.REMAINDER,
        help='extra arguments')

    namespace = parser.parse_args(args)

    # If module is provided, filname is actually the fist arg
    if namespace.module is not None and namespace.filename is not None:
        namespace.args.insert(0, namespace.filename)

    # Parse the serve argument
    if namespace.serve is not None:
        namespace.serve = server.parse_server(namespace.serve, parser)

    return namespace
github vxgmichel / aioconsole / example / cli.py View on Github external
description="Run the echo server and a command line interface.")
    parser.add_argument(
        'server',
        metavar='[HOST:]PORT',
        type=str,
        help='interface for the echo server, default host is localhost')
    parser.add_argument(
        '--serve-cli',
        metavar='[HOST:]PORT',
        type=str,
        help='serve the command line interface on the given host+port '
        'instead of using the standard streams')
    namespace = parser.parse_args(args)
    host, port = parse_server(namespace.server, parser)
    if namespace.serve_cli is not None:
        serve_cli = parse_server(namespace.serve_cli, parser)
    else:
        serve_cli = None
    return host, port, serve_cli
github vxgmichel / aioconsole / example / cli.py View on Github external
def parse_args(args=None):
    parser = argparse.ArgumentParser(
        description="Run the echo server and a command line interface.")
    parser.add_argument(
        'server',
        metavar='[HOST:]PORT',
        type=str,
        help='interface for the echo server, default host is localhost')
    parser.add_argument(
        '--serve-cli',
        metavar='[HOST:]PORT',
        type=str,
        help='serve the command line interface on the given host+port '
        'instead of using the standard streams')
    namespace = parser.parse_args(args)
    host, port = parse_server(namespace.server, parser)
    if namespace.serve_cli is not None:
        serve_cli = parse_server(namespace.serve_cli, parser)
    else:
        serve_cli = None
    return host, port, serve_cli