summaryrefslogtreecommitdiffstats
path: root/bin/cac-get-server-by
blob: b46062518c03a5a1cc89fd591c29578a6641f5a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#! /bin/sh
set -euf

cac-listservers \
  | jq \
    --arg k "$1" \
    --arg v "$2" \
    '
      map(select(.[$k]==$v)) |
      if (. | length) == 1 then
        .[0]
      else
        .
      end
    '