From 7e02c3498362b32e5cfd800b61dd96bba778d3a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Wed, 12 Dec 2018 21:08:46 +0000 Subject: Remove --sort-by flag. There's nothing really meaningful beside the timestamp sorting, remove the flag. If for whatever analysis, a different sorting is needed, that should be post-processed from the generated CSV. --- glucometerutils/glucometer.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/glucometerutils/glucometer.py b/glucometerutils/glucometer.py index cd2331c..30efc83 100755 --- a/glucometerutils/glucometer.py +++ b/glucometerutils/glucometer.py @@ -51,10 +51,6 @@ def main(): '--unit', action='store', choices=[unit.value for unit in common.Unit], help='Select the unit to use for the dumped data.') - parser_dump.add_argument( - '--sort-by', action='store', default='timestamp', - choices=common._ReadingBase._fields, - help='Field to order the dumped data by.') parser_dump.add_argument( '--with-ketone', action='store_true', default=False, help='Enable ketone reading if available on the glucometer.') @@ -107,11 +103,7 @@ def main(): readings = (reading for reading in readings if not isinstance(reading, common.KetoneReading)) - if args.sort_by is not None: - readings = sorted( - readings, key=lambda reading: getattr(reading, args.sort_by)) - - for reading in readings: + for reading in sorted(readings, key=lambda r: r.timestamp): print(reading.as_csv(unit)) elif args.action == 'datetime': if args.set == 'now': -- cgit v1.2.3