Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: standardized CLI #9 #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading