How to use the bpython.args.parse function in bpython

To help you get started, we’ve selected a few bpython 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 bpython / bpython / bpython / urwid.py View on Github external
def main(args=None, locals_=None, banner=None):
    translations.init()

    # TODO: maybe support displays other than raw_display?
    config, options, exec_args = bpargs.parse(
        args,
        (
            "Urwid options",
            None,
            [
                Option(
                    "--twisted",
                    "-T",
                    action="store_true",
                    help=_("Run twisted reactor."),
                ),
                Option(
                    "--reactor",
                    "-r",
                    help=_(
                        "Select specific reactor (see --help-reactors). "
github bpython / bpython / bpython / cli.py View on Github external
def main(args=None, locals_=None, banner=None):
    translations.init()

    config, options, exec_args = argsparse(args)

    # Save stdin, stdout and stderr for later restoration
    orig_stdin = sys.stdin
    orig_stdout = sys.stdout
    orig_stderr = sys.stderr

    try:
        (exit_value, output) = curses_wrapper(
            main_curses,
            exec_args,
            config,
            options.interactive,
            locals_,
            banner=banner,
        )
    finally:
github ivanov / bipython / bipython / __init__.py View on Github external
def main(args=None, locals_=None, banner=None):
    translations.init()

    import argparse
    parser = argparse.ArgumentParser(
            description='the boldly indiscriminate Python interpreter')
    parser.add_argument( '-v','--version', action='version',
            version='%(prog)s ' + version)
    parser.parse_known_args()

    # ok, it's not nice, i'm hiding all of these params, but LTS.
    #
    # TODO: maybe support displays other than raw_display?
    config, options, exec_args = bpargs.parse(args, (
            'Urwid options', None, [
                Option('--twisted', '-T', action='store_true',
                       help=_('Run twisted reactor.')),
                Option('--reactor', '-r',
                       help=_('Select specific reactor (see --help-reactors). '
                       'Implies --twisted.')),
                Option('--help-reactors', action='store_true',
                       help=_('List available reactors for -r.')),
                Option('--plugin', '-p',
                       help=_('twistd plugin to run (use twistd for a list). '
                       'Use "--" to pass further options to the plugin.')),
                Option('--server', '-s', type='int',
                       help=_('Port to run an eval server on (forces Twisted).')),
                ]))

    if options.help_reactors: