#!/usr/bin/env python

"""
TC_USERNAME=[time gamers username] TC_PASSWORD=[time gamers password] tc

Add TC_VISIBLE=1 to not run chromedriver in headless mode.
"""

from os import environ
from sys import exit

from tc import tc


if __name__ == '__main__':
    try:
        username = environ['TC_USERNAME']
        password = environ['TC_PASSWORD']
    except KeyError:
        print(
            'Please put TC_USERNAME and TC_PASSWORD in the environment:\n{}'
            .format(next((l for l in __doc__.split('\n') if l)))
        )
        exit(1)
    visible = bool(environ.get('TC_VISIBLE'))
    tc(username, password, visible)
