Skip to content
Snippets Groups Projects
Commit 053847c5 authored by David Huss's avatar David Huss :speech_balloon:
Browse files

Implement KeyboardInterrupt for --watch

parent bc4d2d31
No related branches found
No related tags found
No related merge requests found
#!/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:
try:
if twolines: if twolines:
meetings_twolines(config, watch, fancy, sum_) meetings_twolines(config, watch, fancy, sum_)
else: else:
list_meetings(config, leaderboards, n, participants, presenter, presenter_id, meetings, watch, fancy, compact, sum_) list_meetings(config, leaderboards, n, participants, presenter, presenter_id, meetings, watch, fancy, compact, sum_)
time.sleep(watch) 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:
try:
print(format_json(config, watch, compact)) print(format_json(config, watch, compact))
time.sleep(watch) time.sleep(watch)
except KeyboardInterrupt:
sys.exit()
else: else:
print(format_json(config, watch, compact)) print(format_json(config, watch, compact))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment