You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
512 B
Plaintext
25 lines
512 B
Plaintext
1 year ago
|
use ./config.nu
|
||
|
|
||
1 year ago
|
# Publishes a message
|
||
1 year ago
|
export def publish [
|
||
1 year ago
|
topic: string
|
||
1 year ago
|
message: string
|
||
1 year ago
|
--title: string
|
||
1 year ago
|
--priority: number
|
||
|
--tags: list<string>
|
||
|
--actions: list<any>
|
||
|
--icon: string
|
||
1 year ago
|
] {
|
||
1 year ago
|
let cfg = ( config read_file cntfy )
|
||
1 year ago
|
|
||
|
let request_body = ({
|
||
|
topic: $topic
|
||
|
title: $title
|
||
|
message: $message
|
||
|
tags: ( $tags | append ( hostname ) )
|
||
|
priority: $priority
|
||
|
actions: $actions
|
||
|
icon: $icon
|
||
|
} | to json )
|
||
|
http put -u $cfg.username -p $cfg.password $cfg.url $request_body
|
||
1 year ago
|
}
|