From 90e8273a7b055b8afea389bc1173a79e44910cad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Sat, 3 Aug 2013 10:02:15 +0100 Subject: glucometer: add support for selecting output units on dump. --- glucometer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/glucometer.py b/glucometer.py index a288dae..db00417 100644 --- a/glucometer.py +++ b/glucometer.py @@ -26,6 +26,9 @@ def main(argv=sys.argv): parser_dump = subparsers.add_parser( 'dump', help='Dump the readings stored in the device.') + parser_dump.add_argument( + '--unit', action='store', choices=common.VALID_UNITS, + help='Select the unit to use for the dumped data.') parser_date = subparsers.add_parser( 'datetime', help='Reads or sets the date and time of the glucometer.') @@ -39,7 +42,7 @@ def main(argv=sys.argv): device = driver.Device(args.device) if args.action == 'dump': - for reading in device.GetReadings(): + for reading in device.GetReadings(args.unit): print('%s,%f' % reading) elif args.action == 'datetime': if args.set: -- cgit v1.2.3