Skip to content

Commit 6212ce4

Browse files
committed
feat(cli): add a debug logging option to the CLI
1 parent 113fadb commit 6212ce4

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

pyomnilogic_local/cli/cli.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import asyncio
4+
import logging
45

56
import click
67

@@ -14,7 +15,8 @@
1415
@click.option("--host", default="127.0.0.1", help="Hostname or IP address of OmniLogic system (default: 127.0.0.1)")
1516
@click.option("--port", default=10444, help="Port number of OmniLogic system (default: 10444)")
1617
@click.option("--timeout", default=5, help="Timeout duration for connecting to OmniLogic system in seconds (default: 5)")
17-
def entrypoint(ctx: click.Context, host: str, port: int, timeout: int) -> None:
18+
@click.option("--debug", is_flag=True, default=False, help="Enable debug logging")
19+
def entrypoint(ctx: click.Context, host: str, port: int, timeout: int, debug: bool) -> None:
1820
"""OmniLogic Local Control - Command line interface for Hayward pool controllers.
1921
2022
This CLI provides local control and monitoring of Hayward OmniLogic and OmniHub
@@ -37,6 +39,9 @@ def entrypoint(ctx: click.Context, host: str, port: int, timeout: int) -> None:
3739
"""
3840
ctx.ensure_object(dict)
3941

42+
if debug:
43+
logging.basicConfig(level=logging.DEBUG)
44+
4045
# Store the host for later connection, but don't connect yet
4146
ctx.obj["HOST"] = host
4247
ctx.obj["PORT"] = port

shell.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ in
2828
nodejs
2929
python314
3030
uv
31+
jq
3132
];
3233

3334
runScript = "bash --rcfile ${shellInit}";

0 commit comments

Comments
 (0)