org-rw/extra-tests/org_rw_check.py

28 lines
544 B
Python
Raw Normal View History

2020-12-09 23:22:22 +00:00
#!/usr/bin/env python3
import os
import sys
2020-12-20 11:39:47 +00:00
import org_rw
2020-12-09 23:22:22 +00:00
top = sys.argv[1]
count = 0
for root, dirs, files in os.walk(top):
for name in files:
if ".org" not in name:
continue
path = os.path.join(root, name)
count += 1
try:
2020-12-20 11:39:47 +00:00
org_rw.load(open(path), extra_cautious=True)
2020-12-09 23:22:22 +00:00
except Exception as err:
import traceback
traceback.print_exc()
print(f"== On {path}")
sys.exit(1)
print("[OK] Check passed on {} files".format(count))