+ parser = OptionParser()
+ parser.add_option("--wordlist", help="A list of words (required)", metavar="WORDS.txt")
+ parser.add_option("--key", help="The passphrase set as $wgCaptchaSecret (required)", metavar="KEY")
+ parser.add_option("--output", help="The directory to put the images in - $wgCaptchaDirectory (required)", metavar="DIR")
+ parser.add_option("--font", help="The font to use (required)", metavar="FONT.ttf")
+ parser.add_option("--font-size", help="The font size (default 40)", metavar="N", type='int', default=40)
+ parser.add_option("--count", help="The maximum number of images to make (default 20)", metavar="N", type='int', default=20)
+ parser.add_option("--blacklist", help="A blacklist of words that should not be used", metavar="FILE")
+ parser.add_option("--fill", help="Fill the output directory to contain N files, overrides count, cannot be used with --dirs", metavar="N", type='int')
+ parser.add_option("--dirs", help="Put the images into subdirectories N levels deep - $wgCaptchaDirectoryLevels", metavar="N", type='int')
+ parser.add_option("--verbose", "-v", help="Show debugging information", action='store_true')
+
+ opts, args = parser.parse_args()
+
+ if opts.wordlist:
+ wordlist = opts.wordlist
+ else:
+ sys.exit("Need to specify a wordlist")
+ if opts.key:
+ key = opts.key
+ else:
+ sys.exit("Need to specify a key")
+ if opts.output:
+ output = opts.output
+ else:
+ sys.exit("Need to specify an output directory")
+ if opts.font and os.path.exists(opts.font):
+ font = opts.font
+ else:
+ sys.exit("Need to specify the location of a font")