From 570585d136a93be9e7e5a21604f0150cf1e111cd Mon Sep 17 00:00:00 2001 From: jimsiff Date: Fri, 13 Dec 2013 16:52:20 -0800 Subject: Add confirmation prompt to zero log argument MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I’m sure there’s a cleaner way to do this, but I wanted a confirmation when zeroing the glucometer data log. --- glucometer.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/glucometer.py b/glucometer.py index 155cd93..1131042 100755 --- a/glucometer.py +++ b/glucometer.py @@ -82,8 +82,13 @@ def main(): else: print(device.get_datetime()) elif args.action == 'zero': - device.zero_log() - print('Device data log zeroed.') + confirm = input('Delete the device data log? (y/N) ') + if confirm.lower() in ['y', 'ye', 'yes']: + device.zero_log() + print('\nDevice data log zeroed.') + else: + print('\nDevice data log not zeroed.') + return 1 else: return 1 except exceptions.Error as err: -- cgit v1.2.3