diff --git a/eadator/eadator.py b/eadator/eadator.py
index d1734ea..6a0c32e 100755
--- a/eadator/eadator.py
+++ b/eadator/eadator.py
@@ -16,14 +16,20 @@ def main(argv=None):
                         type=argparse.FileType('r'))
     parser.add_argument('--dtd', required=False, )
     parser.add_argument('--xsd', required=False, )
+    parser.add_argument('--count', action='store_true' )
 
     if argv is None:
         argv = parser.parse_args()
 
-    message, valid = validate(argv.eadfile[0], argv.dtd, argv.xsd)
+    message, valid, error_count = validate(argv.eadfile[0], argv.dtd, argv.xsd)
 
     if not valid:
         pp(message)
+
+    if argv.count:
+        print("Error count : %d" % error_count)
+
+    if not valid:
         exit(1)
     
 def validate(eadfile, dtd=None, xsd=None):
@@ -48,12 +54,14 @@ def validate(eadfile, dtd=None, xsd=None):
         validator = etree.XMLSchema(etree.parse(xsd))
 
     message = None
+    error_count = 0
     valid = validator.validate(eadfile)
 
     if not valid:
         message = validator.error_log
+        error_count = len(message)
 
-    return message, valid
+    return message, valid, error_count
     
 
 # main() idiom for importing into REPL for debugging 

Add the number of errors
Hello,

Could you add the number of errors at the end of the list of errors?
It could be useful for verify if a modification adds or deletes an error.

Thanks.
diff --git a/tests/test_eadator.py b/tests/test_eadator.py
index a90571d..68d55d9 100755
--- a/tests/test_eadator.py
+++ b/tests/test_eadator.py
@@ -17,17 +17,32 @@ class TestEadator(unittest.TestCase):
                             type=argparse.FileType('r'))
         parser.add_argument('--dtd', default="%s/ents/ead.dtd" % lib_folder, required=False, )
         parser.add_argument('--xsd', default="%s/ents/ead.xsd" % lib_folder, required=False, )
+        parser.add_argument('--count', action='store_true' )
 
         # test valid instances
         eadator.main(parser.parse_args([os.path.join(cmd_folder,'test-dtd-valid.xml')]))
         eadator.main(parser.parse_args([os.path.join(cmd_folder,'test-xsd-valid.xml')]))
-        eadator.validate(os.path.join(cmd_folder,'test-dtd-valid.xml'))
-        eadator.validate(os.path.join(cmd_folder,'test-xsd-valid.xml'))
+
+        message, valid, error_count = eadator.validate(os.path.join(cmd_folder,'test-dtd-valid.xml'))
+        self.assertTrue(valid)
+        self.assertEqual(0,error_count)
+
+        message, valid, error_count = eadator.validate(os.path.join(cmd_folder,'test-xsd-valid.xml'))
+        self.assertTrue(valid)
+        self.assertEqual(0,error_count)
 
         # test invalid instances
         self.assertRaises(SystemExit, eadator.main, parser.parse_args([os.path.join(cmd_folder,'test-dtd-invalid.xml')]))
         self.assertRaises(SystemExit, eadator.main, parser.parse_args([os.path.join(cmd_folder,'test-dtd-invalid.xml')]))
 
+        message, valid, error_count = eadator.validate(os.path.join(cmd_folder,'test-dtd-invalid.xml'))
+        self.assertFalse(valid)
+        self.assertEqual(1,error_count)
+
+        message, valid, error_count = eadator.validate(os.path.join(cmd_folder,'test-xsd-invalid.xml'))
+        self.assertFalse(valid)
+        self.assertEqual(1,error_count)
+
 
 if __name__ == '__main__':
     unittest.main()

pip install -e .
parse_log_pytest
pytest
apt-get update apt-get install -y libxml2-dev libxslt-dev
3.9
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
-e git+https://github.com/eadhost/eadator.git@9ca6058a79729250f0c4399ac54e48d1543017c3#egg=eadator
exceptiongroup==1.2.2
iniconfig==2.1.0
lxml==5.3.1
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
tomli==2.2.1

name: eadator
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - argparse==1.4.0
      - exceptiongroup==1.2.2
      - iniconfig==2.1.0
      - lxml==5.3.1
      - packaging==24.2
      - pluggy==1.5.0
      - pytest==8.3.5
      - tomli==2.2.1
prefix: /opt/conda/envs/eadator

tests/test_eadator.py::TestEadator::test_eadator
eadator/eadator.py
eadator/eadator.py