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

Implement KeyboardInterrupt for --watch

parent bc4d2d31
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import os, sys
import time
import json
import click
......@@ -101,11 +101,14 @@ def meetings(ctx, userconfig, watch, short, compact, n, all_, twolines, leaderbo
config.filter_endpoints(endpoint)
if watch is not None:
while watch is not None:
if twolines:
meetings_twolines(config, watch, fancy, sum_)
else:
list_meetings(config, leaderboards, n, participants, presenter, presenter_id, meetings, watch, fancy, compact, sum_)
time.sleep(watch)
try:
if twolines:
meetings_twolines(config, watch, fancy, sum_)
else:
list_meetings(config, leaderboards, n, participants, presenter, presenter_id, meetings, watch, fancy, compact, sum_)
time.sleep(watch)
except KeyboardInterrupt:
sys.exit()
else:
if twolines:
meetings_twolines(config, watch, fancy, sum_)
......@@ -165,8 +168,11 @@ def json(ctx, userconfig, watch, endpoint, compact):
exit()
if watch is not None:
while watch is not None:
print(format_json(config, watch, compact))
time.sleep(watch)
try:
print(format_json(config, watch, compact))
time.sleep(watch)
except KeyboardInterrupt:
sys.exit()
else:
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