factor
This commit is contained in:
+10
-4
@@ -15,8 +15,11 @@ wrap_app = typer.Typer()
|
|||||||
# Create a subcommand for encode
|
# Create a subcommand for encode
|
||||||
encode_app = typer.Typer()
|
encode_app = typer.Typer()
|
||||||
|
|
||||||
@encode_app.command(short_help="Wrap files into a gzipped tar archive.")
|
# Create a subcommand for decode
|
||||||
def dir(
|
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(
|
files: list[str] = typer.Argument(
|
||||||
..., help="List of files to wrap into a gzipped tar archive."
|
..., 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]")
|
console.print(f"[red]An unexpected error occurred: {e}[/red]")
|
||||||
raise typer.Exit(code=1)
|
raise typer.Exit(code=1)
|
||||||
|
|
||||||
@wrap_app.command(short_help="Decode a base64 encoded, gzipped tar archive.")
|
@decode_app.command("dir", short_help="Decode a base64 encoded, gzipped tar archive.")
|
||||||
def decode(
|
def decode_dir(
|
||||||
destination_dir: str = typer.Option(
|
destination_dir: str = typer.Option(
|
||||||
".", "--destination-dir", "-d", help="Directory to extract the files to."
|
".", "--destination-dir", "-d", help="Directory to extract the files to."
|
||||||
)
|
)
|
||||||
@@ -95,6 +98,9 @@ def decode(
|
|||||||
# Add the encode subcommand to the wrap app
|
# Add the encode subcommand to the wrap app
|
||||||
wrap_app.add_typer(encode_app, name="encode")
|
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
|
# Add the wrap subcommand to the main app
|
||||||
app.add_typer(wrap_app, name="wrap")
|
app.add_typer(wrap_app, name="wrap")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user