diff --git a/pyproject.toml b/pyproject.toml index 4603af3..93d92d9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "meshcore-cli" -version = "0.5.11" +version = "0.5.12" authors = [ { name="Florent de Lamotte", email="florent@frizoncorrea.fr" }, ] diff --git a/src/meshcore_cli/__main__.py b/src/meshcore_cli/__main__.py index 4b9e25f..1b61803 100644 --- a/src/meshcore_cli/__main__.py +++ b/src/meshcore_cli/__main__.py @@ -1,3 +1,3 @@ if __name__ == "__main__": - from meshcore_cli.meshcore_cli import cli + from meshcore_cli.meshcore_cli import cli cli() diff --git a/src/meshcore_cli/meshcore_cli.py b/src/meshcore_cli/meshcore_cli.py index 771756e..1675fa8 100644 --- a/src/meshcore_cli/meshcore_cli.py +++ b/src/meshcore_cli/meshcore_cli.py @@ -929,7 +929,7 @@ async def main(argv): with open(MCCLI_ADDRESS, encoding="utf-8") as f : address = f.readline().strip() - opts, args = getopt.getopt(argv, "a:d:s:ht:p:b:jD") + opts, args = getopt.getopt(argv, "a:d:s:ht:p:b:jDh") for opt, arg in opts : match opt: case "-d" : # name specified on cmdline @@ -948,10 +948,9 @@ async def main(argv): json_output=True case "-D" : debug=True - - if len(args) == 0 : # no args, no action - usage() - return + case "-h" : + usage() + return if (debug==True): logger.setLevel(logging.DEBUG) @@ -984,7 +983,10 @@ async def main(argv): if (json_output) : logger.setLevel(logging.ERROR) - await process_cmds(MC, args, json_output) + if len(args) == 0 : # no args, run in chat mode + await process_cmds(MC, "chat", json_output) + else: + await process_cmds(MC, args, json_output) def cli(): try: