Skip to content

Commit

Permalink
feat: standardized cli
Browse files Browse the repository at this point in the history
  • Loading branch information
devmaxde committed Nov 26, 2024
1 parent 2a5cb05 commit 3d0460d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions metricq_source_snmp/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import click_log # type: ignore
import metricq
from metricq.logging import get_logger
from metricq.cli import metricq_command
from pysnmp.hlapi.asyncio import CommunityData # type: ignore
from pysnmp.hlapi.asyncio import (
ContextData,
Expand Down Expand Up @@ -362,10 +363,7 @@ def on_signal(self, signal: str) -> None:
super().on_signal(signal)


@click.command()
@click.option("--server", default="amqp://localhost/")
@click.option("--token", default="source-py-snmp")
@click_log.simple_verbosity_option(logger) # type: ignore
@metricq_command(default_token="snmp-source")
def run(server: str, token: str) -> None:
src = SnmpSource(token=token, management_url=server)
src.run()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"aiomonitor",
"click",
"click_log",
"metricq ~= 5.3",
"metricq[cli] ~= 5.4",
"pysnmp-lextudio",
"uvloop",
],
Expand Down

0 comments on commit 3d0460d

Please sign in to comment.