This commit is contained in:
dingfeng.wong
2025-07-10 00:12:26 +08:00
parent 4ae037ceab
commit b590f87df4
+10 -4
View File
@@ -15,8 +15,11 @@ wrap_app = typer.Typer()
# Create a subcommand for encode
encode_app = typer.Typer()
@encode_app.command(short_help="Wrap files into a gzipped tar archive.")
def dir(
# Create a subcommand for decode
decode_app = typer.Typer()
@encode_app.command("dir", short_help="Wrap files into a gzipped tar archive.")
def encode_dir(
files: list[str] = typer.Argument(
..., help="List of files to wrap into a gzipped tar archive."
)
@@ -49,8 +52,8 @@ def dir(
console.print(f"[red]An unexpected error occurred: {e}[/red]")
raise typer.Exit(code=1)
@wrap_app.command(short_help="Decode a base64 encoded, gzipped tar archive.")
def decode(
@decode_app.command("dir", short_help="Decode a base64 encoded, gzipped tar archive.")
def decode_dir(
destination_dir: str = typer.Option(
".", "--destination-dir", "-d", help="Directory to extract the files to."
)
@@ -95,6 +98,9 @@ def decode(
# Add the encode subcommand to the wrap app
wrap_app.add_typer(encode_app, name="encode")
# Add the decode subcommand to the wrap app
wrap_app.add_typer(decode_app, name="decode")
# Add the wrap subcommand to the main app
app.add_typer(wrap_app, name="wrap")