Skip to content

Commit

Permalink
Expose include_dirs in python tools
Browse files Browse the repository at this point in the history
  • Loading branch information
Zachary Ferguson committed Nov 22, 2023
1 parent a7c4907 commit 9d9f493
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions docs/spec2html.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,22 @@ def rules_from_pointer(self, pointer):
"--output", "-o", help="Path to the output html file", required=True)
parser.add_argument(
"--title", "-t", help="Title", default="JSON Specification")
parser.add_argument(
"--include-dirs", nargs="+", help="Directories to search for includes",
default=None)
args = parser.parse_args()

if args.include_dirs is None:
args.include_dirs = [pathlib.Path(args.spec_path).parent]

# Template Lookup
mylookup = TemplateLookup(directories=['.'])

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

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

# print(input)

Expand Down
9 changes: 7 additions & 2 deletions scripts/generate_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,18 @@ def main():
parser.add_argument(
"-o,--output", dest="output", help="Path to the output file",
default="defaults.json")
parser.add_argument(
"--include-dirs", nargs="+", help="Directories to search for includes",
default=None)
args = parser.parse_args()

if args.include_dirs is None:
args.include_dirs = [pathlib.Path(args.spec_path).parent]

with open(args.spec_path) as f:
spec = json.load(f)

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

defaults = generate_defaults(spec)

Expand Down

0 comments on commit 9d9f493

Please sign in to comment.