commit 692d100e3694916aebb50bcde690b1f16cb1cd82
parent dd36b18f747fe9546a38a36bcb3a601175bff90f
Author: sshbio <jd@ssh.bio>
Date: Mon, 1 Aug 2016 08:03:32 +0200
irc: Added doc
Diffstat:
3 files changed, 44 insertions(+), 4 deletions(-)
diff --git a/bin/.irc.swp b/bin/.irc.swp
Binary files differ.
diff --git a/bin/irc b/bin/irc
@@ -6,6 +6,25 @@
# \/ \/ \____\ - Irc client based on nc and a script from http://xero.nu
#===============================================================================
+command_help='/c, /connect, /s, /server SERVER
+ Start connection with SERVER
+
+/msg, /privmsg CHANNEL/NICK MESSAGE
+ Send MESSAGE to a particular CHANNEL or NICK
+
+/j, /join CHANNEL/NICK
+ Join a CHANNEL or a private conversation with NICK and set the current
+ channel to this
+
+/nick NICK
+ Update the user'"'"'s nickname to NICK.
+
+/quit
+ Close all connection and quit the client.
+
+/* ARGUMENTS
+ All other commands are sent directly to the server with ARGUMENTS.'
+
NICK="${NICK-$USER}"
FULLNAME='With netcat and a script as a client'
IRC_DIR="$HOME/.cache/irc"
@@ -85,6 +104,14 @@ input()
open_connection "$SERVER"
fi
;;
+ HELP )
+ printf '%s\n' "$commands_help"
+ ;;
+ QUIT )
+ write "QUIT $argument" "$SERVER"
+ printf 'Closing background process\n'
+ kill -9 0
+ ;;
'' )
msg="PRIVMSG $CHANNEL :$argument"
write "$msg" "$SERVER"
@@ -185,8 +212,20 @@ output()
# Prepare the irc log directory
[ -d "$IRC_DIR" ] || mkdir -p "$IRC_DIR"
-# Kill background jobs if exiting
-trap 'kill -9 0' INT EXIT
-
# Start listenning the user input
-input
+[ -p "$IRC_DIR/in" ] || mkfifo "$IRC_DIR/in"
+
+if [ "$(ps ax | grep -F "$IRC_DIR" | wc -l)" -gt 1 ]
+then
+ cd "$IRC_DIR"
+ find . -type f | xargs less -R
+else
+ tail -f "$IRC_DIR/in" | input &
+ printf 'This is an interactive interpreter. You can send irc commands.
+You can also send commands by writing them to '"$IRC_DIR/IN"'.
+For a list of available commands, send "/help".
+If you run the `irc` again, you will get all channels displayed in `less -R`\n'
+ while read command
+ do printf '%s\n' "$command" > "$IRC_DIR/in"
+ done
+fi
diff --git a/shell/.profile b/shell/.profile
@@ -30,6 +30,7 @@ export MAIL="$HOME/Mail/INBOX"
export ENV="$HOME/.profile"
export PATH="$PATH:$HOME/.local/bin" # binaries built locally
export PATH="$PATH:$DOT/bin" # scripts
+export PATH="$PATH:$DOT/bin/$(uname -m)" # binaries carried on $DOT
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"