From b54f7ee69da81a998e5b49ebd4d277fed805427c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20PR=C3=89VOT?= Date: Tue, 15 Nov 2022 21:10:36 +0100 Subject: [PATCH] feat: Make it work in CLI mode --- README.md | 20 ++++++++++---------- setup.py | 2 +- src/pyduro/{pyduro.py => __main__.py} | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) rename src/pyduro/{pyduro.py => __main__.py} (97%) diff --git a/README.md b/README.md index 016be62..417cd0f 100644 --- a/README.md +++ b/README.md @@ -166,13 +166,13 @@ Clone this repository to use the CLI. ### Integrated help ```bash -python src/pyduro.py --help +python -m pyduro --help ``` ### Discover a burner ```bash -python src/pyduro.py [discover] +python -m pyduro [discover] ``` The CLI will exit with 0 if a burner is found, 1 otherwise. @@ -180,7 +180,7 @@ The CLI will exit with 0 if a burner is found, 1 otherwise. ### Get information from a burner ```bash -python src/pyduro.py -b -s -p get "" +python -m pyduro -b -s -p get "" ``` The result will be output as a JSON object that you can then manipulate with @@ -227,7 +227,7 @@ error). **Examples** ```bash -python src/pyduro.py -b 192.168.1.250 -s 1234 -p 12345678 get operating +python -m pyduro -b 192.168.1.250 -s 1234 -p 12345678 get operating > { > "NA": "38", @@ -243,13 +243,13 @@ python src/pyduro.py -b 192.168.1.250 -s 1234 -p 12345678 get operating ``` ```bash -python src/pyduro.py -b 192.168.1.250 -s 1234 -p 12345678 get operating "boiler_ref" +python -m pyduro -b 192.168.1.250 -s 1234 -p 12345678 get operating "boiler_ref" > "boiler_ref=19.0" ``` ```bash -python src/pyduro.py -b 192.168.1.250 -s 1234 -p 12345678 get settings "misc.*" +python -m pyduro -b 192.168.1.250 -s 1234 -p 12345678 get settings "misc.*" > { > [...] @@ -260,7 +260,7 @@ python src/pyduro.py -b 192.168.1.250 -s 1234 -p 12345678 get settings "misc.*" ``` ```bash -python src/pyduro.py -b 192.168.1.250 -s 1234 -p 12345678 get settings "misc.start" +python -m pyduro -b 192.168.1.250 -s 1234 -p 12345678 get settings "misc.start" > "start=0" ``` @@ -273,7 +273,7 @@ python src/pyduro.py -b 192.168.1.250 -s 1234 -p 12345678 get settings "misc.sta ### Update a burner's setting ```bash -python src/pyduro.py -b -s -p set settings "" "" +python -m pyduro -b -s -p set settings "" "" ``` The CLI will exit with the return code return by the burner (0 = success, >0 = @@ -282,9 +282,9 @@ error). **Examples** ```bash -python src/pyduro.py -b 192.168.1.250 -s 1234 -p 12345678 set settings "misc.start" "1" +python -m pyduro -b 192.168.1.250 -s 1234 -p 12345678 set settings "misc.start" "1" ``` ```bash -python src/pyduro.py -b 192.168.1.250 -s 1234 -p 12345678 set settings "misc.stop" "1" +python -m pyduro -b 192.168.1.250 -s 1234 -p 12345678 set settings "misc.stop" "1" ``` diff --git a/setup.py b/setup.py index d79ae3e..df87b44 100644 --- a/setup.py +++ b/setup.py @@ -36,5 +36,5 @@ py_modules=[], python_requires=">=3.6", url="https://github.com/clementprevot/pyduro", - version="1.0.0", + version="1.1.0", ) diff --git a/src/pyduro/pyduro.py b/src/pyduro/__main__.py similarity index 97% rename from src/pyduro/pyduro.py rename to src/pyduro/__main__.py index 3995577..36809a6 100755 --- a/src/pyduro/pyduro.py +++ b/src/pyduro/__main__.py @@ -6,7 +6,7 @@ import argparse import json -from actions import ACTIONS, FUNCTIONS, discover, get, set +from pyduro.actions import ACTIONS, FUNCTIONS, discover, get, set # -----------------------------------------------------------------------------------------------------------------------