Next / Previous / Contents / TCC Help System / NM Tech homepage

16.3. rnck: checkArgs()

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.

rnck
# - - -   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 16.4, “rnck: usage().

rnck
    #-- 2 --
    if len(argList) < 2:
        usage("You must supply at least two arguments.")
    else:
        schemaPath, fileList = argList[0], argList[1:]

    #-- 3 --
    return (schemaPath, fileList)