Skip to content

Commit 9d9f493

Browse files
committed
Expose include_dirs in python tools
1 parent a7c4907 commit 9d9f493

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

docs/spec2html.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,22 @@ def rules_from_pointer(self, pointer):
2727
"--output", "-o", help="Path to the output html file", required=True)
2828
parser.add_argument(
2929
"--title", "-t", help="Title", default="JSON Specification")
30+
parser.add_argument(
31+
"--include-dirs", nargs="+", help="Directories to search for includes",
32+
default=None)
3033
args = parser.parse_args()
3134

35+
if args.include_dirs is None:
36+
args.include_dirs = [pathlib.Path(args.spec_path).parent]
37+
3238
# Template Lookup
3339
mylookup = TemplateLookup(directories=['.'])
3440

3541
print("01 - Loading specification")
3642
with open(args.input) as input_file:
3743
input = json.load(input_file)
3844

39-
# TODO: Expose the include path as a parameter
40-
input = inject_include(input, [pathlib.Path(args.input).parent])
45+
input = inject_include(input, args.include_dirs)
4146

4247
# print(input)
4348

scripts/generate_defaults.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,18 @@ def main():
5151
parser.add_argument(
5252
"-o,--output", dest="output", help="Path to the output file",
5353
default="defaults.json")
54+
parser.add_argument(
55+
"--include-dirs", nargs="+", help="Directories to search for includes",
56+
default=None)
5457
args = parser.parse_args()
5558

59+
if args.include_dirs is None:
60+
args.include_dirs = [pathlib.Path(args.spec_path).parent]
61+
5662
with open(args.spec_path) as f:
5763
spec = json.load(f)
5864

59-
# TODO: Expose the include path as a parameter
60-
spec = inject_include(spec, [pathlib.Path(args.spec_path).parent])
65+
spec = inject_include(spec, args.include_dirs)
6166

6267
defaults = generate_defaults(spec)
6368

0 commit comments

Comments
 (0)