##^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Lance Simms, Stanford University 2009
#Example showing how to take in arguments from the command line
#and use keywords as well
#! /usr/bin/env python
#
#Calling sequence from python interpreter
#>>>run command_line_args 2 'test' 4.5

import sys
import getopt

#This will eliminate the first argument: the path to the program 
ComLinArgs = sys.argv[1:]

#Now print out the number of remaining arguments
print 'Number of Arguments on Command Line : ' +str(len(ComLinArgs))

#Print out all of the arguments
for arg in sys.argv:
	print arg

#Now try to get the keywords
keywords = ['TvFlag=', 'OverRide=' ]
OverRide = 0
TvFlag   = 0
opts, extraparams = getopt.getopt(sys.argv[1:],'',keywords)

print 'Opts:', opts
print 'Extra Parameters:', extraparams
print extraparams

for o,p in opts:
  if o in ['--TvFlag']:
    TvFlag=p
  elif o in ['--OverRide']:
    OverRide=p

print 'OverRide Value =', OverRide
print 'TvFlag Value   =', TvFlag
