From 72a93f419a7b28140695bf7e5ff216d1e1c3f8f4 Mon Sep 17 00:00:00 2001 From: CodingFree Date: Wed, 25 Jan 2017 17:33:54 +0100 Subject: [PATCH 1/2] Add logging --- shic | 1 + 1 file changed, 1 insertion(+) diff --git a/shic b/shic index 2118c55..8030501 100755 --- a/shic +++ b/shic @@ -43,6 +43,7 @@ function _output() { done printf "$_prefix%s\e[0m\n" "$*" + printf "$_prefix%s\e[0m\n" "$*" >> log.txt } # Handle user input From f483e3417facd3e03edb8be1ee35cb574144cd73 Mon Sep 17 00:00:00 2001 From: CodingFree Date: Thu, 26 Jan 2017 09:36:05 +0100 Subject: [PATCH 2/2] Logging functionality --- shic | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/shic b/shic index 8030501..04666be 100755 --- a/shic +++ b/shic @@ -5,6 +5,8 @@ [[ -z $SHIC_PORT ]] && SHIC_PORT=6667 [[ -z $SHIC_NICK ]] && SHIC_NICK="$USER" [[ -z $SHIC_PASS ]] && SHIC_PASS="" +[[ -z $SHIC_LOG ]] && SHIC_LOG="no" + # Automatically execute these inputs at startup, separated by ; # e.g: SHIC_SCRIPT=":j #archlinux; Heya all!; :s; [[ -z $SHIC_SCRIPT ]] && SHIC_SCRIPT="" @@ -43,7 +45,10 @@ function _output() { done printf "$_prefix%s\e[0m\n" "$*" - printf "$_prefix%s\e[0m\n" "$*" >> log.txt + + if [[ "$SHIC_LOG" == "yes" ]]; then + printf "$_prefix%s\e[0m\n" "$*" >> log.txt + fi } # Handle user input @@ -73,15 +78,16 @@ function _input() { } # Parse command line -while getopts "h:p:n:k:c:v" flag; do +while getopts "h:p:n:k:c:v:l" flag; do case $flag in v) printf "shic v. 0.1, by halhen. Released to the public domain.\nSee http://github.com/halhen/shic for help.\n"; exit;; h) SHIC_HOST="$OPTARG";; p) SHIC_PORT="$OPTARG";; n) SHIC_NICK="$OPTARG";; k) SHIC_PASS="$OPTARG";; + l) SHIC_PASS="$OPTARG";; c) source "$OPTARG";; - ?) printf "Unknown option. Usage: $0 [-h hostname] [-p port] [-n nick] [-k password] [-c configfile] [-v]\n" >&2; exit 1;; + ?) printf "Unknown option. Usage: $0 [-h hostname] [-p port] [-n nick] [-k password] [-c configfile] [-l yes] [-v]\n" >&2; exit 1;; esac done