Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(BACK-7688): add CLI entry points for conversion commands #9

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 35 additions & 7 deletions src/erc7730/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,22 @@
ERC-7730 tool.
""",
)
convert_app = typer.Typer(
name="convert",
no_args_is_help=True,
short_help="Commands to convert descriptor files.",
help="""
Commands to convert descriptor files.
""",
)
app.add_typer(convert_app)


@app.command(
name="lint",
short_help="Validate a descriptor file.",
short_help="Validate descriptor files.",
help="""
Validate a descriptor file.
Validate descriptor files.
""",
)
def lint(
Expand Down Expand Up @@ -56,14 +65,33 @@ def lint(
raise typer.Exit(1 if outputs else 0)


@app.command(
name="check",
short_help="Reformat a descriptor file.",
@convert_app.command(
name="eip712-to-erc7730",
short_help="Convert a legacy EIP-712 descriptor file to an ERC-7730 file.",
help="""
Reformat a descriptor file.
Convert a legacy EIP-712 descriptor file to an ERC-7730 file.
""",
)
def format(path: Annotated[Path, typer.Argument(help="The file path")]) -> None:
def convert_eip712_to_erc7730(
input_eip712_path: Annotated[Path, typer.Argument(help="The input EIP-712 file path")],
output_erc7730_path: Annotated[Path, typer.Argument(help="The output ERC-7730 file path")],
) -> None:
# TODO BACK-7687: implement conversion from EIP-712 to ERC-7730 descriptors
raise NotImplementedError()


@convert_app.command(
name="erc7730-to-eip712",
short_help="Convert an ERC-7730 file to a legacy EIP-712 descriptor file.",
help="""
Convert an ERC-7730 file to a legacy EIP-712 descriptor file (if applicable).
""",
)
def convert_erc7730_to_eip712(
input_erc7730_path: Annotated[Path, typer.Argument(help="The input ERC-7730 file path")],
output_eip712_path: Annotated[Path, typer.Argument(help="The output EIP-712 file path")],
) -> None:
# TODO BACK-7686: implement conversion from ERC-7730 to EIP-712 descriptors
raise NotImplementedError()


Expand Down
Loading