stockholm/bin/cac-get-server-by

18 lines
252 B
Bash
Executable File

#! /bin/sh
set -euf
cac-listservers \
| jq \
--arg k "$1" \
--arg v "$2" \
'
map(select(.[$k]==$v)) |
if (. | length) == 0 then
null
elif (. | length) == 1 then
.[0]
else
.
end
'