Commit 053847c5 authored by David Huss's avatar David Huss 💬
Browse files

Implement KeyboardInterrupt for --watch

parent bc4d2d31
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os import os, sys
import time import time
import json import json
import click import click
...@@ -101,11 +101,14 @@ def meetings(ctx, userconfig, watch, short, compact, n, all_, twolines, leaderbo ...@@ -101,11 +101,14 @@ def meetings(ctx, userconfig, watch, short, compact, n, all_, twolines, leaderbo
config.filter_endpoints(endpoint) config.filter_endpoints(endpoint)
if watch is not None: if watch is not None:
while watch is not None: while watch is not None:
if twolines: try:
meetings_twolines(config, watch, fancy, sum_) if twolines:
else: meetings_twolines(config, watch, fancy, sum_)
list_meetings(config, leaderboards, n, participants, presenter, presenter_id, meetings, watch, fancy, compact, sum_) else:
time.sleep(watch) list_meetings(config, leaderboards, n, participants, presenter, presenter_id, meetings, watch, fancy, compact, sum_)
time.sleep(watch)
except KeyboardInterrupt:
sys.exit()
else: else:
if twolines: if twolines:
meetings_twolines(config, watch, fancy, sum_) meetings_twolines(config, watch, fancy, sum_)
...@@ -165,8 +168,11 @@ def json(ctx, userconfig, watch, endpoint, compact): ...@@ -165,8 +168,11 @@ def json(ctx, userconfig, watch, endpoint, compact):
exit() exit()
if watch is not None: if watch is not None:
while watch is not None: while watch is not None:
print(format_json(config, watch, compact)) try:
time.sleep(watch) print(format_json(config, watch, compact))
time.sleep(watch)
except KeyboardInterrupt:
sys.exit()
else: else:
print(format_json(config, watch, compact)) print(format_json(config, watch, compact))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment