26 lines
711 B
Python
26 lines
711 B
Python
import argparse
|
|
import sys
|
|
|
|
from . import compatibility, validateStream
|
|
from .formatter.text_plain import Formatter
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description="W3C feedvalidator")
|
|
parser.add_argument("-b", "--base", type=str, required=False, default="",
|
|
help="Base URL of document")
|
|
parser.add_argument("file", type=argparse.FileType("rb"), help="File to validate")
|
|
args = parser.parse_args()
|
|
|
|
events = validateStream(args.file, base=args.base)['loggedEvents']
|
|
events = compatibility.AA(events)
|
|
fmt = Formatter(events)
|
|
if len(fmt) > 0:
|
|
for f in fmt:
|
|
print(f)
|
|
sys.exit(1)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|