Skip to content

Commit

Permalink
feat: standardized CLI #9
Browse files Browse the repository at this point in the history
  • Loading branch information
Max KvR authored and devmaxde committed Jan 28, 2025
1 parent 3a484da commit e7a612e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/metricq/metricq-python:v5.3 AS BUILDER
FROM ghcr.io/metricq/metricq-python:v5.4 AS BUILDER

USER root
RUN apt-get update \
Expand All @@ -19,7 +19,7 @@ RUN /home/metricq/.local/bin/tox
RUN pip install --user .


FROM ghcr.io/metricq/metricq-python:v5.3
FROM ghcr.io/metricq/metricq-python:v5.4

COPY --from=BUILDER --chown=metricq:metricq /home/metricq/.local /home/metricq/.local

Expand Down
9 changes: 3 additions & 6 deletions metricq_source_modbus/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@

import logging

import click
import click_completion # type: ignore
import click_log # type: ignore
from metricq.cli import metricq_command
from metricq.logging import get_logger

from .source import ModbusSource
Expand All @@ -46,10 +46,7 @@
click_completion.init()


@click.command()
@click.option("--server")
@click.option("--token", default="source-modbus")
@click_log.simple_verbosity_option(logger) # type: ignore
def run(server, token) -> None:
@metricq_command(default_token="source-modbus")
def run(server: str, token: str) -> None:
src = ModbusSource(url=server, token=token)
src.run()
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ packages =
metricq_source_modbus
python_requires = >=3.10
install_requires =
metricq ~= 5.3
metricq[cli] ~= 5.4
async-modbus >= 0.2.1
python-hostlist
pydantic
Expand Down

0 comments on commit e7a612e

Please sign in to comment.