Skip to content

Commit e6d29af

Browse files
committed
sync-dbscheme-fragments: add files argument
1 parent 2416568 commit e6d29af

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

config/dbscheme-fragments.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"/*- Configuration files with key value pairs -*/",
1616
"/*- YAML -*/",
1717
"/*- XML Files -*/",
18+
"/*- XML: sourceline -*/",
1819
"/*- DEPRECATED: External defects and metrics -*/",
1920
"/*- DEPRECATED: Snapshot date -*/",
2021
"/*- DEPRECATED: Duplicate code -*/",

config/sync-dbscheme-fragments.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#!/usr/bin/env python3
22

3+
import argparse
34
import json
45
import os
6+
import pathlib
57
import re
68

79

@@ -24,15 +26,23 @@ def validate_fragments(fragments):
2426

2527

2628
def main():
27-
script_dir = os.path.dirname(os.path.realpath(__file__))
29+
script_path = os.path.realpath(__file__)
30+
script_dir = os.path.dirname(script_path)
31+
parser = argparse.ArgumentParser(
32+
prog=os.path.basename(script_path),
33+
description='Sync dbscheme fragments across files.'
34+
)
35+
parser.add_argument('files', metavar='dbscheme_file', type=pathlib.Path, nargs='*', default=[],
36+
help='dbscheme files to check')
37+
args = parser.parse_args()
2838

2939
with open(os.path.join(script_dir, "dbscheme-fragments.json"), "r") as f:
3040
config = json.load(f)
3141

3242
fragment_headers = set(config["fragments"])
3343
fragments = {}
3444
ok = True
35-
for file in config["files"]:
45+
for file in args.files + config["files"]:
3646
with open(os.path.join(os.path.dirname(script_dir), file), "r") as dbscheme:
3747
header = None
3848
line_number = 1

0 commit comments

Comments
 (0)