fix: show help when getting nothing

This commit is contained in:
OverflowCat 2023-08-10 03:39:33 +08:00
parent ba180b530f
commit 2659755fe4
2 changed files with 12 additions and 6 deletions

View File

@ -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))

View File

@ -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)