cli: display an error if no ip is given

also bump the version to 0.2.4.1 with this fix.
This commit is contained in:
Teemu Rytilahti
2017-03-26 03:19:44 +02:00
parent b1cc0fd3f6
commit 23e51a8686
3 changed files with 12 additions and 2 deletions

View File

@@ -1,3 +1,4 @@
import sys
import click
import logging
from click_datetime import Datetime
@@ -22,6 +23,10 @@ def cli(ctx, ip, debug):
if ctx.invoked_subcommand == "discover":
return
if ip is None:
click.echo("You must specify the IP either by --ip or setting PYHS100_IP environment variable!")
sys.exit(-1)
plug = SmartPlug(ip)
ctx.obj = plug