Continued work on Windows CLI

This commit is contained in:
Philipp Heckel 2022-05-09 16:22:52 -04:00
parent 7d473488de
commit 613348d37e
9 changed files with 135 additions and 71 deletions

View file

@ -38,7 +38,7 @@ Here's an example showing how to publish a simple message using a POST request:
=== "PowerShell"
``` powershell
Invoke-RestMethod -Method 'Post' -Uri https://ntfy.sh/topic -Body "Backup successful 😀" -UseBasicParsing
Invoke-RestMethod -Method 'Post' -Uri https://ntfy.sh/mytopic -Body "Backup successful" -UseBasicParsing
```
=== "Python"

View file

@ -145,12 +145,27 @@ Here's an example config file that subscribes to three different topics, executi
fi
```
=== "%AppData%\ntfy\client.yml"
```
subscribe:
- topic: echo-this
command: 'echo Message received: %message%'
- topic: calc
command: calc
if:
priority: high,urgent
- topic: toastthis
command: |
notifu /p "a title: %NTFY_TITLE%" /m "%NTFY_MESSAGE%"
exit 0
```
In this example, when `ntfy subscribe --from-config` is executed:
* Messages to `echo-this` simply echos to standard out
* Messages to `alerts` display as desktop notification for high priority messages using [notify-send](https://manpages.ubuntu.com/manpages/focal/man1/notify-send.1.html)
* Messages to `calc` open the gnome calculator 😀 (*because, why not*)
* Messages to `print-temp` execute an inline script and print the CPU temperature
* Messages to `print-temp` execute an inline script and print the CPU temperature (Linux version only)
I hope this shows how powerful this command is. Here's a short video that demonstrates the above example: