def main():
    "The entry point for the console script xbmcswift2.\n\n    The 'xbcmswift2' script is command bassed, so the second argument is always\n    the command to execute. Each command has its own parser options and usages.\n    If no command is provided or the -h flag is used without any other\n    commands, the general help message is shown.\n    "
    parser = OptionParser()
    if (len(sys.argv) == 1):
        parser.set_usage(USAGE)
        parser.error('At least one command is required.')
    command = sys.argv[1]
    if (command == '-h'):
        parser.set_usage(USAGE)
        (opts, args) = parser.parse_args()
    if (command not in COMMANDS.keys()):
        parser.error('Invalid command')
    manager = COMMANDS[command]
    if hasattr(manager, 'option_list'):
        for (args, kwargs) in manager.option_list:
            parser.add_option(*args, **kwargs)
    if hasattr(manager, 'usage'):
        parser.set_usage(manager.usage)
    (opts, args) = parser.parse_args()
    manager.run(opts, args[1:])
The entry point for the console script xbmcswift2.

The 'xbcmswift2' script is command bassed, so the second argument is always
the command to execute. Each command has its own parser options and usages.
If no command is provided or the -h flag is used without any other
commands, the general help message is shown.
def main():
    "The entry point for the console script xbmcswift2.\n\n    The 'xbcmswift2' script is command bassed, so the second argument is always\n    the command to execute. Each command has its own parser options and usages.\n    If no command is provided or the -h flag is used without any other\n    commands, the general help message is shown.\n    "
    parser = OptionParser()
    if (len(sys.argv) == 1):
        parser.set_usage(USAGE)
        parser.error('At least one command is required.')
    command = sys.argv[1]
    if (command == '-h'):
        parser.set_usage(USAGE)
        (opts, args) = parser.parse_args()
    if (command not in COMMANDS.keys()):
        parser.error('Invalid command')
    manager = COMMANDS[command]
    if hasattr(manager, 'option_list'):
        for (args, kwargs) in manager.option_list:
            parser.add_option(*args, **kwargs)
    if hasattr(manager, 'usage'):
        parser.set_usage(manager.usage)
    (opts, args) = parser.parse_args()
    manager.run(opts, args[1:])