sob

Simple output bar
git clone https://git.sinitax.com/codemadness/sob
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

commit becbbb1ea807edd361472632cb1571b5c492c41f
parent c7bf0604ba222bf9437b3500c27e5d7a14f9f25a
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Thu,  2 Oct 2014 01:05:42 +0000

update for irc + ii

Diffstat:
Mconfig.def.h | 2+-
Ascripts/complete_nick | 26++++++++++++++++++++++++++
Mscripts/complete_word | 7+++++--
Mscripts/history | 4++--
4 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -1,5 +1,5 @@ static const char *prompt = "> "; -static const char *completewordcmd[] = { "/bin/sh", "-c", "$HOME/.sob/scripts/complete_word", NULL }; +static const char *completewordcmd[] = { "/bin/sh", "-c", "$HOME/.sob/scripts/complete_nick", NULL }; static const char *historycmd[] = { "/bin/sh", "-c", "$HOME/.sob/scripts/history", NULL }; static const char *yankcmd[] = { "/bin/sh", "-c", "/bin/xsel -i -p", NULL }; static const char *resizecmd = "tmux resize-pane -y 4 2> /dev/null"; diff --git a/scripts/complete_nick b/scripts/complete_nick @@ -0,0 +1,26 @@ +#!/bin/sh + +file="$OUTFILE" +test -f "$file" || exit 1 + +grepword() { + if test x"$1" = x""; then + grep -oE '^[0-9\-]* (<[^>]*)' "$file" | sed 's@^[0-9\-]* <@@g' + else + grep -oE '^[0-9\-]* (<[^>]*)' "$file" | sed 's@^[0-9\-]* <@@g' | grep -E "^$1" + fi +} + +word="$SOBWRITE" + +#if test x"$DISPLAY" = x""; then +# line=$(grepword "$word" | sort | uniq | slmenu -l 20) +#else +# line=$(grepword "$word" | sort | uniq | dmenu -l 20) +#fi + +line=$(grepword "$word" | sort | uniq | dmenu -l 20) + +if test x"$line" != x""; then + printf '%s\n' "$line" +fi diff --git a/scripts/complete_word b/scripts/complete_word @@ -1,10 +1,13 @@ #!/bin/sh +file="$OUTFILE" +test -f "$file" || exit 1 + grepword() { - grep -E "^$1" < out.log + grep -E "^$1" < "$file" } -read -r word +word="$SOBWRITE" #if test x"$DISPLAY" = x""; then # line=$(grepword "$word" | sort | uniq | slmenu -l 20) diff --git a/scripts/history b/scripts/history @@ -1,7 +1,7 @@ #!/bin/sh -file="out.log" -test -f "$file" || exit 1 +file="$OUTFILE" +test -f x"$file" || exit 1 #if test x"$DISPLAY" = x""; then # line=$(tail -n 100 "$file" | slmenu -l 20)