Skip to content

Commit

Permalink
sync-dbscheme-fragments: add files argument
Browse files Browse the repository at this point in the history
  • Loading branch information
aibaars committed May 22, 2023
1 parent 2416568 commit e6d29af
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions config/dbscheme-fragments.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"/*- Configuration files with key value pairs -*/",
"/*- YAML -*/",
"/*- XML Files -*/",
"/*- XML: sourceline -*/",
"/*- DEPRECATED: External defects and metrics -*/",
"/*- DEPRECATED: Snapshot date -*/",
"/*- DEPRECATED: Duplicate code -*/",
Expand Down
14 changes: 12 additions & 2 deletions config/sync-dbscheme-fragments.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/usr/bin/env python3

import argparse
import json
import os
import pathlib
import re


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


def main():
script_dir = os.path.dirname(os.path.realpath(__file__))
script_path = os.path.realpath(__file__)
script_dir = os.path.dirname(script_path)
parser = argparse.ArgumentParser(
prog=os.path.basename(script_path),
description='Sync dbscheme fragments across files.'
)
parser.add_argument('files', metavar='dbscheme_file', type=pathlib.Path, nargs='*', default=[],
help='dbscheme files to check')
args = parser.parse_args()

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

fragment_headers = set(config["fragments"])
fragments = {}
ok = True
for file in config["files"]:
for file in args.files + config["files"]:
with open(os.path.join(os.path.dirname(script_dir), file), "r") as dbscheme:
header = None
line_number = 1
Expand Down

0 comments on commit e6d29af

Please sign in to comment.