code: def validate(ctx, mapfiles, expand):
      
  
      all_mapfiles = get_mapfiles(mapfiles)
  
      if len(all_mapfiles) == 0:
          click.echo("No Mapfiles found at the following paths: {}".format(",".join(mapfiles)))
          return
  
      validation_count = 0
      errors = 0
  
      for fn in all_mapfiles:
          fn = click.format_filename(fn)
          d = mappyfile.open(fn, expand_includes=expand, include_position=True)
  
          validation_messages = mappyfile.validate(d)
          if validation_messages:
              for v in validation_messages:
                  v["fn"] = fn
                  msg = "{fn} (Line: {line} Column: {column}) {message} - {error}".format(**v)
                  click.echo(msg)
                  errors += 1
          else:
              click.echo("{} validated successfully".format(fn))
              validation_count += 1
  
      click.echo("{} file(s) validated ({} successfully)".format(len(all_mapfiles), validation_count))
      sys.exit(errors)
docs: Validate Mapfile(s) against the Mapfile schema
  
      The MAPFILES argument is a list of paths, either to individual Mapfiles, or a folders containing Mapfiles.
      Wildcards are supported (natively on Linux, and up to one level deep on Windows).
      Validation errors are reported to the console. The program returns the error count - this will be 0 if no
      validation errors are encountered.
  
      Example of validating a single Mapfile:
  
          mappyfile validate C:/Temp/valid.map
  
      Example of validating two folders containing Mapfiles, without expanding INCLUDES:
  
          mappyfile validate C:/Temp/*.map D:/GitHub/mappyfile/tests/mapfiles/*.map --no-expand