# to display script help, use '-h' or '--help' as an argument

 

from optparse import OptionParser

 

parser = OptionParser(usage='Something, by Spacecoyote\n%prog file [options]',

                      prog='YourFile.py', version='x.x',

                      description='This does not do anything'

                      )

 

parser.add_option("--file", dest = 'filename', help = "write report to FILE", metavar = "FILE")

parser.add_option('-t', action='store_true', dest='tracing', help='default value = False')

parser.add_option('--novice', action='store_const', const='novice', dest='mode')

parser.add_option('--guru', action='store_const', const='guru', dest='mode')

parser.add_option('--coord', action='store', type='int', dest='coord', nargs=2)

parser.add_option('--speed', action='store', type='choice', dest='speed', choices=['slow', 'fast',' ludicrous'])

parser.add_option('-o', '--outfile', action='store', type='string', dest='outfile')

parser.add_option('-d', '--debuglevel', action='store', type='int', dest='debug')

 

# parser.set_usage('This is substitute usage text.\n This is a second line of text')

 

parser.set_defaults(tracing="False", debug=0, speed="fast", coord=(2,2), mode="novice")

 

opt, args = parser.parse_args()

 

# print option values

print 'tracing   :', opt.tracing

print 'outfile   :', opt.outfile

print 'debug     :', opt.debug

print 'speed     :', opt.speed

print 'coord     :', opt.coord

print 'mode      :', opt.mode

print

#print dir(parser)

print opt

print args