diff --git a/contrib/README.md b/contrib/README.md index 9b70ad4..b50cfdc 100644 --- a/contrib/README.md +++ b/contrib/README.md @@ -5,6 +5,12 @@ subject to any robustness or stability criteria. This document contains a section for each script contained in this directory further explaining how it is intended to be used. +## irc-menu + +This script spawns an insomnia instance on a remote machine using +[mosh][mosh web], it allows selecting the channel for which the instance +should be spawned interactively using [fzf][fzf github]. + ## termux-client This script allows using insomnia from Android phones running @@ -29,6 +35,8 @@ Afterwards, the script can be installed by creating the directory it executable. If successful, `termux-client` can be added to your home screen as 1x1 widget. +[mosh web]: https://mosh.org +[fzf github]: https://github.com/junegunn/fzf [termux website]: https://termux.com/ [termux widget]: https://wiki.termux.com/wiki/Termux:Widget [fdroid com.termux]: https://f-droid.org/packages/com.termux/ diff --git a/contrib/irc-menu b/contrib/irc-menu new file mode 100644 index 0000000..6aa2fd0 --- /dev/null +++ b/contrib/irc-menu @@ -0,0 +1,23 @@ +#!/bin/sh +set -e + +# Host on which insomnia / hii are runnig. +HOST="someuser@example.org" + +# Relative path to hii IRC directory on the host. +IDIR="irc" + +target=$(ssh "${HOST}" find "${IDIR}" -maxdepth 3 -name in -a -type p | \ + awk -F / '{ printf("%s/%s\n", $2, $3) }' | fzf) + +if [ -z "${target}" ]; then + exit 0 +elif [ "${target}" = "${target%%/*}" ]; then + server="${target}" + target="" +else + server="${target%%/*}" + target="${target##*/}" +fi + +exec mosh "${HOST}" -- insomnia "${server}" "${target}"