Skip to content

Commit

Permalink
Switches up the way config_file is sent to convert
Browse files Browse the repository at this point in the history
  • Loading branch information
sherjeelshabih committed Aug 21, 2024
1 parent 0339602 commit 30ad68c
Showing 1 changed file with 13 additions and 22 deletions.
35 changes: 13 additions & 22 deletions src/pynxtools/dataconverter/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ def main_cli():
@click.option(
"-c",
"--config",
"config_file",
type=click.Path(exists=True, dir_okay=False, file_okay=True, readable=True),
default=None,
help="A json config file for the reader",
Expand All @@ -358,8 +359,9 @@ def convert_cli(
ignore_undocumented: bool,
skip_verify: bool,
mapping: str,
config: str,
config_file: str,
fail: bool,
**kwargs,
):
"""This command allows you to use the converter functionality of the dataconverter."""
if params_file:
Expand Down Expand Up @@ -399,27 +401,16 @@ def convert_cli(
)

try:
if config: # most but not all readers demand a config.json file
convert(
tuple(file_list) + input_file,
reader,
nxdl,
output,
skip_verify,
config_file=config,
ignore_undocumented=ignore_undocumented,
fail=fail,
)
else:
convert(
tuple(file_list) + input_file,
reader,
nxdl,
output,
skip_verify,
ignore_undocumented=ignore_undocumented,
fail=fail,
)
convert(
tuple(file_list) + input_file,
reader,
nxdl,
output,
skip_verify,
ignore_undocumented=ignore_undocumented,
fail=fail,
**kwargs,
)
except FileNotFoundError as exc:
raise click.BadParameter(str(exc)) from exc
except ValidationFailed as exc:
Expand Down

0 comments on commit 30ad68c

Please sign in to comment.