Пример #1
0
                    parser.error("Invalid argument assignment: {0}. Please "
                                 "check your command.".format(arg))
                variables.append({'name': name, 'value': value})
                arguments.remove(arg)

        if len(arguments) > 0:
            parser.error("Unbalanced arguments. Please check your command.")
        for i in range(0, len(arguments), 2):
            variables.append({'name': arguments[i], 'value': arguments[i + 1]})
        return variables

    # Setup the command parser
    program = os.path.basename(sys.argv[0]).replace(".py", "")
    parser = UtilitiesParser(version=VERSION_FRM.format(program=program),
                             description=DESCRIPTION,
                             usage=USAGE,
                             add_help_option=False,
                             prog=program)

    # Default option to provide help information
    parser.add_option("--help",
                      action="help",
                      help="display this help message and exit")

    # Add --License option
    parser.add_option("--license",
                      action='callback',
                      callback=license_callback,
                      help="display program's license and exit")

    # Add display width option
Пример #2
0
                                 "check your command.".format(arg))
                variables.append({'name': name, 'value': value})
                arguments.remove(arg)

        if len(arguments) > 0:
            parser.error("Unbalanced arguments. Please check your command.")
        for i in range(0, len(arguments), 2):
            variables.append({'name': arguments[i], 'value': arguments[i + 1]})
        return variables

    # Setup the command parser
    program = os.path.basename(sys.argv[0]).replace(".py", "")
    parser = UtilitiesParser(
        version=VERSION_FRM.format(program=program),
        description=DESCRIPTION,
        usage=USAGE,
        add_help_option=False,
        prog=program
    )

    # Default option to provide help information
    parser.add_option("--help", action="help",
                      help="display this help message and exit")

    # Add --License option
    parser.add_option("--license", action='callback',
                      callback=license_callback,
                      help="display program's license and exit")

    # Add display width option
    parser.add_option("--width", action="store", dest="width",
Пример #3
0
        def on_exit(signal, func=None):
            """Override the on_exit callback.
            """
            if os.name == "posix":
                termios.tcsetattr(sys.stdin, termios.TCSADRAIN,
                                  old_terminal_settings)
            logging.info("Failover console stopped with SIGTERM.")
            sys.exit(0)

    set_signal_handler(on_exit)

    # Setup the command parser
    program = os.path.basename(sys.argv[0]).replace(".py", "")
    parser = UtilitiesParser(version=VERSION_FRM.format(program=program),
                             description=DESCRIPTION,
                             usage=USAGE,
                             add_help_option=False,
                             prog=program)

    # Default option to provide help information
    parser.add_option("--help",
                      action="help",
                      help="display this help message and exit")

    # Add --License option
    parser.add_option("--license",
                      action='callback',
                      callback=license_callback,
                      help="display program's license and exit")

    # Setup utility-specific options:
Пример #4
0
            """Override the on_exit callback.
            """
            if os.name == "posix":
                termios.tcsetattr(sys.stdin, termios.TCSADRAIN,
                                  old_terminal_settings)
            logging.info("Failover console stopped with SIGTERM.")
            sys.exit(0)

    set_signal_handler(on_exit)

    # Setup the command parser
    program = os.path.basename(sys.argv[0]).replace(".py", "")
    parser = UtilitiesParser(
        version=VERSION_FRM.format(program=program),
        description=DESCRIPTION,
        usage=USAGE,
        add_help_option=False,
        prog=program
    )

    # Default option to provide help information
    parser.add_option("--help", action="help",
                      help="display this help message and exit")

    # Add --License option
    parser.add_option("--license", action='callback',
                      callback=license_callback,
                      help="display program's license and exit")

    # Setup utility-specific options:
    add_failover_options(parser)