commit d8ab98b077cbe9c3a3aa9e8f7e57dce9f25f4855 Spenser Truex <truex@equwal.com> 2025-09-04 10:33:25 -0700 Add lchat-connect wrapper for quick and easy shell connection
lc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
diff --git a/lc b/lc new file mode 100755 index 0000000..b496429 --- /dev/null +++ b/lc @@ -0,0 +1,25 @@ +#!/bin/sh + +# Script to connect to existing IRC channels using lchat-connect +# Usage: lchat-channel <channel-name> +# just a wrapper for lchat-connect that is less verbose + +[ $# -eq 1 ] || { echo "Usage: $0 <channel-name>"; exit 1; } + +channel="$1" +irc_dir="$HOME/scr/irc" + +[ -d "$irc_dir" ] || { echo "Error: IRC directory $irc_dir not found"; exit 1; } + +# Find server with the channel using POSIX approach +server="" +for server_dir in "$irc_dir"/irc.*; do + [ -d "$server_dir" ] || continue + [ -d "$server_dir/#$channel" ] || continue + server="${server_dir##*/}" + break +done + +[ -n "$server" ] || { echo "Error: Channel #$channel not found"; exit 1; } + +exec lchat-connect "$irc_dir" "$server" "#$channel"