def do_rot13(self, args): """ Encryption, now for the command line. Usage: rot13 <text> [<text2> [...]] """ import string from lunchinator.cli import LunchCLIModule rot13 = string.maketrans( u"ABCDEFGHIJKLMabcdefghijklmNOPQRSTUVWXYZnopqrstuvwxyz", u"NOPQRSTUVWXYZnopqrstuvwxyzABCDEFGHIJKLMabcdefghijklm") args = LunchCLIModule.getArguments(args) for aString in args: try: aString = aString.encode("utf-8") print string.translate(aString, rot13) except: self.logger.exception("Error encrypting string: %s", aString)