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 #19 #20

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
9 changes: 4 additions & 5 deletions metricq_sink_websocket/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import click_log # type: ignore
from aiohttp import web
from metricq import get_logger
from metricq.cli import metricq_command

from .routes import setup_routes
from .sink import Sink
Expand Down Expand Up @@ -78,14 +79,12 @@ def create_app(token: str, url: str, port: int) -> web.Application:
return app


@click.command()
@click.argument("url", default="amqp://localhost/")
@click.option("--token", default="metricq-sink-websocket")
@metricq_command(default_token="metricq-sink-websocket")
@click.option("--host", default="0.0.0.0")
@click.option("--port", type=int, default=3000)
@click.version_option(client_version)
@click_log.simple_verbosity_option(logger) # type: ignore
def runserver_cmd(url: str, token: str, host: str, port: int) -> None:
def runserver_cmd(server: str, token: str, host: str, port: int) -> None:
try:
import uvloop # type: ignore

Expand All @@ -94,5 +93,5 @@ def runserver_cmd(url: str, token: str, host: str, port: int) -> None:
except ImportError:
logger.debug("using default event loop")

app = create_app(token, url, port)
app = create_app(token, server, port)
web.run_app(app, host=host, port=port)
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ install_requires =
click ~= 8.1.7
click-completion ~= 0.5.2
click_log ~= 0.4.0
metricq ~= 5.3.0
metricq[cli] ~= 5.4.0

[options.extras_require]
uvloop =
Expand Down
Loading