|
@@ -287,8 +287,21 @@ def main(argv = None): |
|
|
|
|
|
|
|
|
if argv is None: |
|
|
if argv is None: |
|
|
argv = sys.argv[1:] |
|
|
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: |
|
|
try: |
|
|
# Passed in a JSON string (e.g. on the command line) |
|
|
# Passed in a JSON string (e.g. on the command line) |
|
|