summaryrefslogtreecommitdiffstats
path: root/glucometer.py
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@flameeyes.eu>2017-04-17 17:47:58 +0200
committerDiego Elio Pettenò <flameeyes@flameeyes.eu>2017-04-17 17:50:30 +0200
commit5ef9873ebefd144b2e91cac0f45c7b2361b4d71b (patch)
tree0afa97025d296b5b7d59c405d059fa2342c88379 /glucometer.py
parentSerial drivers: factor out opening of the serial port to a new base class. (diff)
downloadglucometerutils-5ef9873ebefd144b2e91cac0f45c7b2361b4d71b.tar
glucometerutils-5ef9873ebefd144b2e91cac0f45c7b2361b4d71b.tar.gz
glucometerutils-5ef9873ebefd144b2e91cac0f45c7b2361b4d71b.tar.bz2
glucometerutils-5ef9873ebefd144b2e91cac0f45c7b2361b4d71b.tar.lz
glucometerutils-5ef9873ebefd144b2e91cac0f45c7b2361b4d71b.tar.xz
glucometerutils-5ef9873ebefd144b2e91cac0f45c7b2361b4d71b.tar.zst
glucometerutils-5ef9873ebefd144b2e91cac0f45c7b2361b4d71b.zip
Diffstat (limited to 'glucometer.py')
-rwxr-xr-xglucometer.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/glucometer.py b/glucometer.py
index dc5d78b..19a47a8 100755
--- a/glucometer.py
+++ b/glucometer.py
@@ -9,6 +9,7 @@ __license__ = 'MIT'
import argparse
import importlib
+import inspect
import logging
import sys
@@ -35,6 +36,9 @@ def main():
'https://docs.python.org/3/library/logging.html#logging-levels'))
subparsers.add_parser(
+ 'help', help=('Display a description of the driver, including supported '
+ 'features and known quirks.'))
+ subparsers.add_parser(
'info', help='Display information about the meter.')
subparsers.add_parser(
'zero', help='Zero out the data log of the meter.')
@@ -67,6 +71,12 @@ def main():
args.driver)
return 1
+ # This check needs to happen before we try to initialize the device, as the
+ # help action does not require a --device at all.
+ if args.action == 'help':
+ print(inspect.getdoc(driver))
+ return 0
+
device = driver.Device(args.device)
device.connect()