Argument processing is pretty basic. There must be at least two positional arguments; the first is the schema path, the rest are files to be checked.
# - - - c h e c k A r g s
def checkArgs():
'''Check the command line arguments.
[ if sys.argv is a valid command line ->
return (the SCHEMA argument, a list of the FILE arguments)
else ->
sys.stderr +:= error message
stop execution ]
'''
#-- 1 --
argList = sys.argv[1:]
For the usage message, see Section 15.4, “rnck: usage()”.
#-- 2 --
if len(argList) < 2:
usage ( "You must supply at least two arguments." )
else:
schemaPath, fileList = argList[0], argList[1:]
#-- 3 --
return (schemaPath, fileList)