parser = optparse.OptionParser("%prog yourname@yourdomain.org \"Your support message\" [options]") parser.add_option("-n", "--network", action="store_true", help="send network related logfiles (/var/log/daemon.log)", default=False) parser.add_option("-s", "--standard", action="store_true", help="send standard error logfile (dmesg)", default=False) parser.add_option("-u", "--usb", action="store_true", help="send universal serial bus related logfiles (lsusb -v)", default=False) parser.add_option("-v", "--video", action="store_true", help="send video card related logfiles (/var/log/Xorg.0.log)", default=False) # parser.add_option("-m", "--message", help="send an optional help message") #depecrated (options, args) = parser.parse_args() # Check to see if all mandatory arguments have been filled. if len(args) != 2: print "Please specify the required options. See help (-h) for more information." sys.exit(1) # Eval the arguments the user threw at as. if args[0] != "": user_email = args[0] else: print "Please specify an email address. See help (-h) for more information" if args[1] != "": user_message = args[1] else: print "Please specify a support message. See help (-h) for more information"