Skip to content

Commit

Permalink
Added verbosity switch.
Browse files Browse the repository at this point in the history
  • Loading branch information
nuntz committed Dec 3, 2016
1 parent 7e2c9d1 commit bfc641c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions unicli.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ def devices(ctx):
@click.pass_context
def clients(ctx):
"""List active clients."""
click.echo('Listing the active clients...')
if ctx.obj['VERBOSE']:
click.echo('Listing the active clients...')
r = requests.get(ctx.obj['URL'] + 'stat/sta', verify=ctx.obj['VERIFY'],
cookies=ctx.obj['COOKIES'])

Expand All @@ -102,7 +103,8 @@ def get_hostname(value):
@click.pass_context
def unblock(ctx, mac):
"""Unblock a client using its MAC address."""
click.echo('Unblocking %s...' % mac)
if ctx.obj['VERBOSE']:
click.echo('Unblocking %s...' % mac)
payload = {'cmd': 'unblock-sta', 'mac': mac}
r = requests.post(ctx.obj['URL'] + 'cmd/stamgr', verify=ctx.obj['VERIFY'],
cookies=ctx.obj['COOKIES'], data=json.dumps(payload))
Expand All @@ -114,7 +116,8 @@ def unblock(ctx, mac):
@click.pass_context
def block(ctx, mac):
"""Block a client using its MAC address."""
click.echo('Blocking %s...' % mac)
if ctx.obj['VERBOSE']:
click.echo('Blocking %s...' % mac)
payload = {'cmd': 'block-sta', 'mac': mac}
r = requests.post(ctx.obj['URL'] + 'cmd/stamgr', verify=ctx.obj['VERIFY'],
cookies=ctx.obj['COOKIES'], data=json.dumps(payload))
Expand Down

0 comments on commit bfc641c

Please sign in to comment.