Skip to content

Commit

Permalink
contrib: add irc-menu
Browse files Browse the repository at this point in the history
  • Loading branch information
nmeum committed May 13, 2022
1 parent 8594799 commit 08afa3e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
8 changes: 8 additions & 0 deletions contrib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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/
Expand Down
23 changes: 23 additions & 0 deletions contrib/irc-menu
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh
set -e

# Host on which insomnia / hii are runnig.
HOST="[email protected]"

# 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}"

0 comments on commit 08afa3e

Please sign in to comment.