~tardypad/dotfiles

ref: 00c0c349a1b8960152233f11caa9ea1a40e395a3 dotfiles/files/scripts/shell/ssh-tags -rwxr-xr-x 553 bytes
00c0c349 — Damien Tardy-Panis Add presentation mode to mako to hide notifications 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh

TAGS=$*

IGNORE_TAGS='^ *name '
while [ "$#" -gt 0 ]; do
  IGNORE_TAG=$( echo "$1" | sed 's/\([^=]*\)=.*/\1/' )
  IGNORE_TAGS="${IGNORE_TAGS}|^ *${IGNORE_TAG} "
  shift
done

SELECTED_HOST=$(
  query-hosts-tags hosts "${TAGS}" \
    | fzf \
      --no-multi \
      --exit-0 \
      --select-1 \
      --height=10 \
      --layout=reverse \
      --preview="query-hosts-tags tags {} | grep -vE '${IGNORE_TAGS}'" \
      --preview-window='right:70%:border-left'
)

[ -n "${SELECTED_HOST}" ] || exit

TERM=xterm-256color ssh "${SELECTED_HOST}"