def main():
<EOL>try:<EOL><INDENT>command_fn, opts = _parse_arguments(sys.argv[<NUM_LIT:1>:])<EOL>if command_fn == purge.purge or '<STR_LIT>' not in opts:<EOL><INDENT>return command_fn(opts)<EOL><DEDENT>environment = Environment.load(<EOL>opts['<STR_LIT>'] or '<STR_LIT:.>',<EOL>opts['<STR_LIT>'] if '<STR_LIT>' in opts else '<STR_LIT>')<EOL>if command_fn not in COMMANDS_THAT_USE_SSH:<EOL><INDENT>return command_fn(environment, opts)<EOL><DEDENT>user_profile = UserProfile()<EOL>user_profile.test_ssh_key(environment)<EOL>return command_fn(environment, opts, user_profile)<EOL><DEDENT>except DatacatsError as e:<EOL><INDENT>_error_exit(e)<EOL><DEDENT>except SystemExit:<EOL><INDENT>raise<EOL><DEDENT>except:<EOL><INDENT>exc_info = "<STR_LIT:\n>".join([line.rstrip()<EOL>for line in traceback.format_exception(*sys.exc_info())])<EOL>user_message = ("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>).format(args="<STR_LIT:U+0020>".join(sys.argv[<NUM_LIT:1>:]))<EOL>_error_exit(DatacatsError(user_message,<EOL>parent_exception=UndocumentedError(exc_info)))<EOL><DEDENT>
The main entry point for datacats cli tool

(as defined in setup.py's entry_points)
It parses the cli arguments for corresponding options
and runs the corresponding command