diff --git a/ament_xmllint/ament_xmllint/main.py b/ament_xmllint/ament_xmllint/main.py index 6eecb6dd..e1a27a7a 100755 --- a/ament_xmllint/ament_xmllint/main.py +++ b/ament_xmllint/ament_xmllint/main.py @@ -29,7 +29,7 @@ def main(argv=sys.argv[1:]): - extensions = ['xml'] + default_extensions = ['xml'] parser = argparse.ArgumentParser( description='Check XML markup using xmllint.', @@ -38,9 +38,10 @@ def main(argv=sys.argv[1:]): 'paths', nargs='*', default=[os.curdir], - help='The files or directories to check. For directories files ending ' - 'in %s will be considered.' % - ', '.join(["'.%s'" % e for e in extensions])) + help='The files or directories to check. For directories, only files ending ' + 'in %s will be considered (unless overruled by the --extensions ' + 'option)' % + ', '.join(["'.%s'" % e for e in default_extensions])) parser.add_argument( '--exclude', nargs='*', @@ -48,6 +49,11 @@ def main(argv=sys.argv[1:]): help='Exclude specific file names and directory names from the check') # not using a file handle directly # in order to prevent leaving an empty file when something fails early + parser.add_argument( + '--extensions', + nargs='*', + default=default_extensions, + help='The file extensions of the files to check') parser.add_argument( '--xunit-file', help='Generate a xunit compliant XML file') @@ -56,7 +62,7 @@ def main(argv=sys.argv[1:]): if args.xunit_file: start_time = time.time() - files = get_files(args.paths, extensions, args.exclude) + files = get_files(args.paths, args.extensions, args.exclude) if not files: print('No files found', file=sys.stderr) return 1