def main():

    try:
        command = COMMANDS.get(args.all.pop(0).lower(), usage)
    except:
        command = usage

    # fallback to usage.
    if command is usage:
        return command()

    # retrieve lang
    try:
        lang = args.grouped.get('lang', []).pop(0)
        if lang not in LANGS:
            raise ValueError(u"Unknown lang code")
    except __HOLE__ as e:
        puts(colored.red(e.message))
        usage()
    except IndexError:
        lang = None

    # update cmd requires more args.
    if command is update:
        # extract user & password
        try:
            user = args.grouped.get('--user', []).pop(0)
            password = args.grouped.get('--password', []).pop(0)
        except:
            raise
            user = password = None

        if not user or not password:
            print(colored.red(
                u"You need to provide Transifex.com credentials"))
            usage()

        return command(user, password, lang)

    # execute command with lang argument.
    return command(lang)
dataset/ETHPy150Open kobotoolbox/kobocat/script/i18ntool.py/main