Assorted shell and Python scripts
1#!/usr/bin/env nu
2
3let mf_auth_token = (secret-tool lookup miniflux-auth-token hyperreal)
4let mf_api_url = "https://miniflux.bsd.cafe/v1/feeds/counters"
5
6let unreads = (
7 ( curl \
8 -s \
9 -X GET \
10 -H "Content-Type: application/json" \
11 -H $"X-Auth-Token: ($mf_auth_token)" \
12 ($mf_api_url)
13 )
14 | from json
15 | get unreads
16 | values
17)
18
19if ($unreads | is-empty) {
20 "0"
21} else {
22 $unreads | math sum
23}
24# vim: sw=4 sts=4 ts=4 ai et ft=nu