def main():
    try:
        params = {}
        r_api_key = None
        opts, args = getopt.getopt(sys.argv[1:], 'hta:')
        for opt, val in opts:
            if opt == '-h':
                usage()
                sys.exit(0)
            if opt == '-t':
                params['import_time_entries'] = True
            if opt == '-a':
                r_api_key = val
        if r_api_key: 
            r_url, y_url, y_user, y_password = args[:4]
            project_ids = args[4:]
            redmine_importer = RedmineImporter(
                r_api_key, r_url, None, None, y_url, y_user, y_password, params)
        else:
            r_url, r_user, r_password, y_url, y_user, y_password = args[:6]
            project_ids = args[6:]
            redmine_importer = RedmineImporter(
                None, r_url, r_user, r_password, y_url, y_user, y_password, params)
    except getopt.GetoptError, e:
        print e
        usage()
        sys.exit(1)
    except __HOLE__, e:
        print 'Not enough arguments'
        usage()
        sys.exit(1)
    redmine_importer.do_import(project_ids)
dataset/ETHPy150Open JetBrains/youtrack-rest-python-library/python/redmine2youtrack.py/main