Skip to content

Commit db3918d

Browse files
fix: broken cli due to shitty async implementation (#864)
* add Update download.py * Update download.py
1 parent cf313e2 commit db3918d

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/cli/app/commands/download.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@
1313
app = typer.AsyncTyper(help="Download encrypted files via Chithi.")
1414

1515

16-
@app.command()
16+
@app.async_command()
1717
async def download(
1818
link: Annotated[str, typer.Argument(help="URL or 'slug#key'")],
1919
instance_url: Annotated[str | None, typer.Option("--url", "-u")] = None,
2020
password: Annotated[str | None, typer.Option("--password", "-p")] = None,
2121
output: Annotated[Path, typer.Option("--output", "-o")] = Path("."),
2222
) -> None:
23+
"""Download a file from the public instance."""
2324
try:
2425
slug = ""
2526
key_secret = ""

src/cli/app/commands/upload.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
console: Console = Console()
1818

1919

20-
@app.command()
20+
@app.async_command()
2121
async def upload(
2222
path: Annotated[Path, typer.Argument(exists=True, resolve_path=True)],
2323
instance_url: Annotated[str | None, typer.Option("--url", "-u")] = None,
@@ -28,6 +28,9 @@ async def upload(
2828
minimal: Annotated[
2929
bool, typer.Option("--minimal", "-m", help="Only output the download URL.")
3030
] = False,
31+
no_qr: Annotated[
32+
bool, typer.Option("--no-qr", help="Do not print the QR code.")
33+
] = False,
3134
) -> None:
3235
"""Compress, encrypt, and upload a file or folder."""
3336
try:
@@ -94,7 +97,8 @@ async def upload(
9497
else:
9598
# Pretty output
9699
typer.echo("\n✓ Upload complete!")
97-
print_compact_qr(download_url, console)
100+
if not no_qr:
101+
print_compact_qr(download_url, console)
98102
typer.echo(f"\n Download URL : {download_url}")
99103
if password:
100104
typer.echo(

0 commit comments

Comments
 (0)