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.iteritems():<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 varname == "<STR_LIT>":<EOL><INDENT>varname = "<STR_LIT>"<EOL><DEDENT>if isinstance(val, str) or isinstance(val, unicode):<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 init:<EOL><INDENT>from os.path import expanduser<EOL>home = expanduser("<STR_LIT>")<EOL>filepath = home + "<STR_LIT>"<EOL>try:<EOL><INDENT>cmd = """<STR_LIT>""" % locals()<EOL>p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True)<EOL><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT>try:<EOL><INDENT>cmd = """<STR_LIT>""" % locals()<EOL>p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True)<EOL><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>if sort or archive:<EOL><INDENT>ws = workspace(<EOL>log=log,<EOL>settings=settings,<EOL>fileOrWorkspacePath=pathToFileOrWorkspace<EOL>)<EOL><DEDENT>if sort:<EOL><INDENT>ws.sort()<EOL><DEDENT>if archive:<EOL><INDENT>ws.archive_done()<EOL><DEDENT>if sync:<EOL><INDENT>tp = syncc(<EOL>log=log,<EOL>settings=settings,<EOL>workspaceRoot=pathToWorkspace,<EOL>workspaceName=workspaceName,<EOL>syncFolder=pathToSyncFolder,<EOL>editorialRootPath=editorialRootPath,<EOL>includeFileTags=fileTagsFlag<EOL>)<EOL>tp.sync()<EOL><DEDENT>if reminders:<EOL><INDENT>r = reminderss(<EOL>log=log,<EOL>settings=settings<EOL>)<EOL>r.import_list(<EOL>listName=listName,<EOL>pathToTaskpaperDoc=pathToTaskpaperDoc<EOL>)<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*