mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-23 03:33:35 +00:00
Avoid discovery on --help (#335)
This commit is contained in:
parent
a39cef9a8c
commit
6e988bd9a9
@ -1,6 +1,7 @@
|
|||||||
"""python-kasa cli tool."""
|
"""python-kasa cli tool."""
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
|
import sys
|
||||||
from pprint import pformat as pf
|
from pprint import pformat as pf
|
||||||
from typing import cast
|
from typing import cast
|
||||||
|
|
||||||
@ -66,6 +67,12 @@ pass_dev = click.make_pass_decorator(SmartDevice)
|
|||||||
@click.pass_context
|
@click.pass_context
|
||||||
async def cli(ctx, host, alias, target, debug, bulb, plug, lightstrip, strip, type):
|
async def cli(ctx, host, alias, target, debug, bulb, plug, lightstrip, strip, type):
|
||||||
"""A tool for controlling TP-Link smart home devices.""" # noqa
|
"""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":
|
||||||
|
# Context object is required to avoid crashing on sub-groups
|
||||||
|
ctx.obj = SmartDevice(None)
|
||||||
|
return
|
||||||
|
|
||||||
if debug:
|
if debug:
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user