From 2659755fe405f153346ac9670712764dbed45bf7 Mon Sep 17 00:00:00 2001 From: OverflowCat Date: Thu, 10 Aug 2023 03:39:33 +0800 Subject: [PATCH] fix: show help when `get`ting nothing --- biliarchiver/cli_tools/get_command.py | 10 +++++++++- biliarchiver/cli_tools/up_command.py | 8 +++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/biliarchiver/cli_tools/get_command.py b/biliarchiver/cli_tools/get_command.py index c6f5617..868859e 100644 --- a/biliarchiver/cli_tools/get_command.py +++ b/biliarchiver/cli_tools/get_command.py @@ -360,7 +360,15 @@ class URLorIntParamType(click.ParamType): "--favlist", help=click.style("收藏夹", fg="green"), type=URLorIntParamType("fid") ) def get(**kwargs): - if not any(kwargs.values()): + if ( + not kwargs["favlist"] + and not kwargs["series"] + and not kwargs["ranking"] + and not kwargs["up_videos"] + and not kwargs["popular_precious"] + and not kwargs["popular_series"] + ): + click.echo(click.style("ERROR: 请指定获取方式。", fg="red")) click.echo(get.get_help(click.Context(get))) return asyncio.run(main(**kwargs)) diff --git a/biliarchiver/cli_tools/up_command.py b/biliarchiver/cli_tools/up_command.py index b485aa4..f1654e8 100644 --- a/biliarchiver/cli_tools/up_command.py +++ b/biliarchiver/cli_tools/up_command.py @@ -39,7 +39,7 @@ def up( bvids: TextIOWrapper, by_storage_home_dir: bool, update_existing: bool, - collection, + collection: str, ): from biliarchiver._biliarchiver_upload_bvid import upload_bvid from biliarchiver.config import config @@ -50,11 +50,9 @@ def up( if "-" in bvid_with_upper_part: bvid = bvid_with_upper_part.split("-")[0] - upload_bvid(bvid, update_existing=update_existing, - collection=collection) + upload_bvid(bvid, update_existing=update_existing, collection=collection) elif bvids: bvids_from_file = bvids.read().splitlines() for bvid in bvids_from_file: - upload_bvid(bvid, update_existing=update_existing, - collection=collection) + upload_bvid(bvid, update_existing=update_existing, collection=collection)