from bongo.admintool import DemoCommands from bongo.admintool import ServerCommands from bongo.admintool import SetupCommands from bongo.admintool import UserCommands parser = CommandParser() parser.add_option("-U", "--authuser", type="string", default="admin", help="admin username [default %default]") parser.add_option("-P", "--authpass", type="string", help="admin password") parser.add_option("-c", "--context", type="string", help="MDB context") parser.add_option("", "--debug", action="store_true", help="enable debugging output") parser.add_commands(AgentCommands, "Agent") parser.add_commands(DemoCommands) parser.add_commands(ServerCommands, "Server") parser.add_commands(SetupCommands, "Setup") parser.add_commands(UserCommands, "User") if __name__ == '__main__': (command, options, args) = parser.parse_args() formatter = logging.Formatter("%(levelname)s: %(message)s") console = logging.StreamHandler() console.setFormatter(formatter) logging.root.addHandler(console) if options.debug: logging.root.setLevel(logging.DEBUG)
parser = CommandParser() parser.add_option("", "--host", type="string", default="localhost", help="hostname [default %default]") parser.add_option("", "--port", type="string", default="689", help="port [default %default]") parser.add_option("", "--debug", action="store_true", help="enable debugging output") parser.add_option("-u", "--user", type="string", help="connect as this user") parser.add_option("-p", "--password", type="string", help="connect with this password") parser.add_option("-s", "--store", type="string", help="store (if different from user)") parser.add_commands(BackupCommands, "Backup") parser.add_commands(CalendarCommands, "Calendar") parser.add_commands(ContactCommands, "Contact") parser.add_commands(InteractiveCommands) parser.add_commands(MailCommands, "Mail") parser.add_commands(TestCommands, "Testing") parser.add_commands(StoreCommands, "Store") if __name__ == '__main__': (command, options, args) = parser.parse_args() formatter = logging.Formatter("%(levelname)s: %(message)s") console = logging.StreamHandler() console.setFormatter(formatter) logging.root.addHandler(console)