mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 19:23:34 +00:00
Fix --help on subcommands (#886)
Pass a dummy object as context object as it will not be used by --help anyway. Also, allow defining --help anywhere in the argv, not just in the last place.
This commit is contained in:
parent
5599756d28
commit
7db989e2ec
@ -306,9 +306,9 @@ async def cli(
|
||||
):
|
||||
"""A tool for controlling TP-Link smart home devices.""" # noqa
|
||||
# no need to perform any checks if we are just displaying the help
|
||||
if sys.argv[-1] == "--help":
|
||||
if "--help" in sys.argv:
|
||||
# Context object is required to avoid crashing on sub-groups
|
||||
ctx.obj = Device(None)
|
||||
ctx.obj = object()
|
||||
return
|
||||
|
||||
# If JSON output is requested, disable echo
|
||||
|
Loading…
Reference in New Issue
Block a user