def main(arguments=None):
<EOL>su = tools(<EOL>arguments=arguments,<EOL>docString=__doc__,<EOL>logLevel="<STR_LIT>",<EOL>options_first=False,<EOL>projectName="<STR_LIT>"<EOL>)<EOL>arguments, settings, log, dbConn = su.setup()<EOL>for arg, val in arguments.items():<EOL><INDENT>if arg[<NUM_LIT:0>] == "<STR_LIT:->":<EOL><INDENT>varname = arg.replace("<STR_LIT:->", "<STR_LIT>") + "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>varname = arg.replace("<STR_LIT:<>", "<STR_LIT>").replace("<STR_LIT:>>", "<STR_LIT>")<EOL><DEDENT>if isinstance(val, str) or isinstance(val, str):<EOL><INDENT>exec(varname + "<STR_LIT>" % (val,))<EOL><DEDENT>else:<EOL><INDENT>exec(varname + "<STR_LIT>" % (val,))<EOL><DEDENT>if arg == "<STR_LIT>":<EOL><INDENT>dbConn = val<EOL><DEDENT>log.debug('<STR_LIT>' % (varname, val,))<EOL><DEDENT>startTime = times.get_now_sql_datetime()<EOL>log.info(<EOL>'<STR_LIT>' %<EOL>(startTime,))<EOL>if hostFlag:<EOL><INDENT>dbSettings = {<EOL>'<STR_LIT:host>': hostFlag,<EOL>'<STR_LIT:user>': userFlag,<EOL>'<STR_LIT:password>': passwdFlag,<EOL>'<STR_LIT>': dbNameFlag<EOL>}<EOL><DEDENT>elif settings:<EOL><INDENT>dbSettings = settings["<STR_LIT>"]<EOL><DEDENT>if index:<EOL><INDENT>add_htm_ids_to_mysql_database_table(<EOL>raColName=raCol,<EOL>declColName=decCol,<EOL>tableName=tableName,<EOL>dbConn=dbConn,<EOL>log=log,<EOL>primaryIdColumnName=primaryIdCol,<EOL>reindex=forceFlag,<EOL>dbSettings=dbSettings<EOL>)<EOL><DEDENT>if search:<EOL><INDENT>cs = conesearch(<EOL>log=log,<EOL>dbConn=dbConn,<EOL>tableName=tableName,<EOL>columns=False,<EOL>ra=ra,<EOL>dec=dec,<EOL>radiusArcsec=float(radius),<EOL>separations=True,<EOL>distinct=False,<EOL>sqlWhere=False<EOL>)<EOL>matchIndies, matches = cs.search()<EOL>if not renderFlag:<EOL><INDENT>print(matches.table())<EOL><DEDENT>elif renderFlag == "<STR_LIT>":<EOL><INDENT>print(matches.json())<EOL><DEDENT>elif renderFlag == "<STR_LIT>":<EOL><INDENT>print(matches.csv())<EOL><DEDENT>elif renderFlag == "<STR_LIT>":<EOL><INDENT>print(matches.yaml())<EOL><DEDENT>elif renderFlag == "<STR_LIT>":<EOL><INDENT>print(matches.markdown())<EOL><DEDENT>elif renderFlag == "<STR_LIT>":<EOL><INDENT>print(matches.markdown())<EOL><DEDENT>elif renderFlag == "<STR_LIT>":<EOL><INDENT>print(matches.mysql(tableName=resultsTable))<EOL><DEDENT><DEDENT>if level:<EOL><INDENT>from HMpTy import HTM<EOL>mesh = HTM(<EOL>depth=int(level),<EOL>log=log<EOL>)<EOL>htmids = mesh.lookup_id(ra, dec)<EOL>print(htmids[<NUM_LIT:0>])<EOL><DEDENT>if "<STR_LIT>" in locals() and dbConn:<EOL><INDENT>dbConn.commit()<EOL>dbConn.close()<EOL><DEDENT>endTime = times.get_now_sql_datetime()<EOL>runningTime = times.calculate_time_difference(startTime, endTime)<EOL>log.info('<STR_LIT>' %<EOL>(endTime, runningTime, ))<EOL>return<EOL>
*The main function used when ``cl_utils.py`` is run as a single script from the cl, or when installed as a cl command*