SF.net SVN: tmda: [2099] trunk/tmda/bin/tmda-check-address

[email protected] Thu, 12 Oct 2006 18:44:04 -0700
Newsgroups gmane.mail.spam.tmda.cvs
Message-ID <[email protected]>
Revision: 2099
          http://svn.sourceforge.net/tmda/?rev=2099&view=rev
Author:   jasonrm
Date:     2006-10-12 18:44:01 -0700 (Thu, 12 Oct 2006)

Log Message:
-----------
Make sure that this command has at least one arg.

Modified Paths:
--------------
    trunk/tmda/bin/tmda-check-address

Modified: trunk/tmda/bin/tmda-check-address
===================================================================
--- trunk/tmda/bin/tmda-check-address	2006-10-13 01:22:17 UTC (rev 2098)
+++ trunk/tmda/bin/tmda-check-address	2006-10-13 01:44:01 UTC (rev 2099)
@@ -40,15 +40,14 @@
 
 # option parsing
 
-opt_usage = \
-"""%prog [options] address [senderaddr]
+opt_usage = "%prog [options] ADDRESS [SENDER]"
 
-Check a tagged (dated, keyword, or sender style only) e-mail address.
+opt_desc = \
+"""Check a tagged (dated, keyword, or sender style only) e-mail
+address.  Required 'ADDRESS' is the address you want to check. Optional
+'SENDER' is the sender address to verify if checking a sender-style
+address."""
 
-address is the address you want to check.
-    
-senderaddr is the sender address to verify if checking a sender style address."""
-
 opt_list = [
     make_option("-c", "--config-file",
                 metavar="FILE", dest="config_file",
@@ -62,20 +61,23 @@
                 help="show full TMDA version information and exit"),
     ]
 
-parser = OptionParser(option_list=opt_list, version=Version.TMDA, usage=opt_usage)
+parser = OptionParser(option_list=opt_list, version=Version.TMDA, 
+                      usage=opt_usage, description=opt_desc)
 (opts, args) = parser.parse_args()
 
 if opts.full_version:
     print Version.ALL
     sys.exit()
-
 if opts.config_file:
      os.environ['TMDARC'] = opts.config_file
+if len(args) < 1:
+    parser.error('ADDRESS is required.')
 
 
 from TMDA import Defaults
 from TMDA import Address
 
+
 def formattime(timestamp):
     if opts.localtime:
         timetuple = time.localtime(int(timestamp))


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.