Add the CLI command to send one notification.
This commit is contained in:
@@ -6,6 +6,7 @@ from notification_producer.producer_client import ProducerClient
|
||||
console = Console()
|
||||
cli_app = typer.Typer(rich_markup_mode="rich")
|
||||
notify = typer.Typer()
|
||||
cli_app.add_typer(notify, name="notify", help="To send notification.")
|
||||
|
||||
|
||||
@cli_app.command()
|
||||
@@ -27,3 +28,30 @@ def up(
|
||||
asyncio.run(client.notify_interactive())
|
||||
|
||||
|
||||
@notify.command()
|
||||
def message(
|
||||
ip: str = typer.Option(
|
||||
"127.0.0.1", "--ip", "-i",
|
||||
help="The server's ip.",
|
||||
),
|
||||
port: int = typer.Option(
|
||||
5554, "--port", "-p",
|
||||
help="The server's port for [b]producers[/].",
|
||||
),
|
||||
notification_title: str = typer.Option(
|
||||
"notification", "--title", "-t",
|
||||
help="[b yellow]The title[/] for the [y b]notification[/]."
|
||||
),
|
||||
# TODO as argument (required)
|
||||
notification_message: str = typer.Option(
|
||||
'hello', "--title", "-t",
|
||||
help="[b yellow]The message[/] for the [y b]notification[/]."
|
||||
),
|
||||
):
|
||||
"""
|
||||
This command [b]send[/] [yellow b]one notification[/].
|
||||
"""
|
||||
|
||||
client = ProducerClient(ip, port)
|
||||
asyncio.run(client.notify(notification_title, notification_message))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user