def main(arguments): if not len(arguments) >= 1: transcript.error.output("missing command; aborting.") return command = arguments[0] arguments = arguments[1:] if command in local_commands: command = local_commands[command] elif command in frontend_commands: command = frontend_commands[command] else: transcript.error.output("invalid command; aborting.") return None database.load() outcome = command.execute(arguments) database.store() return outcome
def main(arguments): if not len(arguments) >= 2: transcript.error.output("missing command; aborting.") return None store = arguments[0] command = arguments[1] arguments = arguments[2:] try: os.chdir(store) except Exception: transcript.error.output_exception(sys.exc_info()) return None if command == "backend-loop": if len(arguments) == 0: try: database.load() backend = Backend(backend_commands) backend.loop() database.store() return 0 except Exception: transcript.error.output_exception(sys.exc_info()) return 1 else: transcript.error.output("invalid command; aborting.") return 1 elif command in backend_commands: command = backend_commands[command] try: database.load() outcome = command.execute(arguments) database.store() return outcome except Exception: transcript.error.output_exception(sys.exc_info()) return 1 else: transcript.error.output("invalid command; aborting.") return None
def main() -> None: """Entrypoint.""" database.load() door.start() rtm_client = slack.RTMClient(token=os.environ['SLACK_API_TOKEN']) rtm_client.start()