Skip to content

Commit 7c3cfeb

Browse files
authored
Fix command line arguments order (#106)
1 parent f9a1d2b commit 7c3cfeb

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

src/pdl/pdl.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,20 @@ def main():
192192

193193
args = parser.parse_args()
194194

195+
# This case must be before `if args.pdl is None:`
196+
if args.schema:
197+
schema, top_level_schema = models_json_schema(
198+
[
199+
(Program, "validation"),
200+
(PdlBlock, "validation"),
201+
(PdlBlocks, "validation"),
202+
],
203+
title="PDL Schemas",
204+
)
205+
top_level_schema["anyOf"] = list(schema.values())
206+
print(json.dumps(top_level_schema, indent=2))
207+
return
208+
195209
if args.pdl is None:
196210
parser.print_help()
197211
return
@@ -231,19 +245,6 @@ def main():
231245
)
232246
return
233247

234-
if args.schema:
235-
schema, top_level_schema = models_json_schema(
236-
[
237-
(Program, "validation"),
238-
(PdlBlock, "validation"),
239-
(PdlBlocks, "validation"),
240-
],
241-
title="PDL Schemas",
242-
)
243-
top_level_schema["anyOf"] = list(schema.values())
244-
print(json.dumps(top_level_schema, indent=2))
245-
return
246-
247248
initial_scope = {}
248249
if args.data_file is not None:
249250
with open(args.data_file, "r", encoding="utf-8") as scope_fp:

0 commit comments

Comments
 (0)