Browse Source

Support -h and -v in nilm-trainola

tags/nilmtools-1.4.9^0
Jim Paris 8 years ago
parent
commit
3e7527ab57
1 changed files with 15 additions and 2 deletions
  1. +15
    -2
      nilmtools/trainola.py

+ 15
- 2
nilmtools/trainola.py View File

@@ -287,8 +287,21 @@ def main(argv = None):

if argv is None:
argv = sys.argv[1:]
if len(argv) != 1:
raise DataError("need one argument, either a dictionary or JSON string")
if len(argv) != 1 or argv[0] == '-h' or argv[0] == '--help':
printf("usage: %s [-h] [-v] <json-config-dictionary>\n\n", sys.argv[0])
printf(" Where <json-config-dictionary> is a JSON-encoded " +
"dictionary string\n")
printf(" with exemplar and stream data.\n\n")
printf(" See extras/trainola-test-param*.js in the nilmtools " +
"repository\n")
printf(" for examples.\n")
if len(argv) != 1:
raise SystemExit(1)
raise SystemExit(0)

if argv[0] == '-v' or argv[0] == '--version':
printf("%s\n", nilmtools.__version__)
raise SystemExit(0)

try:
# Passed in a JSON string (e.g. on the command line)


Loading…
Cancel
Save