1#!/bin/sh2set -e34# Host on which insomnia / hii are runnig.5HOST="someuser@example.org"67# Absolute path to the hii IRC directory on the host (no trailing slash).8IDIR="/home/someuser/irc"910sheet() {11 tr '\n' ',' | xargs termux-dialog sheet -t "${0##*/}" -v | jq -r .text12}1314channels() {15 ssh "${HOST}" "sh -c 'find \"${IDIR}\" -maxdepth 3 -name in \16 -a -type p | sed \"s|^${IDIR}/\(.*\)/in|\1|\"'"17}1819target=$(channels | sheet)20if [ -z "${target}" ]; then21 termux-toast "No target selected, aborting."22 exit 123elif [ "${target}" = "${target%%/*}" ]; then24 server="${target}"25 target=""26else27 server="${target%%/*}"28 target="${target##*/}"29fi3031exec mosh "${HOST}" -- insomnia "${server}" "${target}"