def notify(ctx, provider):
"""Send a notification to a passed provider.
Data should be passed via a key=value input like so:
notifiers notify pushover token=foo user=bar message=test
"""
p = get_notifier(provider)
data = {}
for item in ctx.args:
data.update([item.split('=')])
if 'message' not in data:
message = click.get_text_stream('stdin').read()
if not message:
raise click.ClickException(
"'message' option is required. "
"Either pass it explicitly or pipe into the command"
)
data['message'] = message
rsp = p.notify(**data)
rsp.raise_on_errors()
评论列表
文章目录