complete_nick: if there is one match, just print it - sob - simple output bar | |
git clone git://git.codemadness.org/sob | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 87edcaa976f44a0058d14a9c5c1185ed8c4f2111 | |
parent 0623bdc3978eb327390c15de16deb991299e8b31 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Sat, 25 Oct 2014 10:23:11 +0000 | |
complete_nick: if there is one match, just print it | |
Diffstat: | |
M scripts/complete_nick | 7 ++++++- | |
1 file changed, 6 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/scripts/complete_nick b/scripts/complete_nick | |
@@ -19,7 +19,12 @@ word="$SOBWRITE" | |
# line=$(grepword "$word" | sort | uniq | dmenu -l 20) | |
#fi | |
-line=$(grepword "$word" | sort | uniq | dmenu -l 20) | |
+matches=$(grepword "$word" | sort | uniq | wc -l) | |
+if test x"$matches" = x"1"; then | |
+ line=$(grepword "$word" | tail -n 1) | |
+else | |
+ line=$(grepword "$word" | sort | uniq | dmenu -l 20) | |
+fi | |
if test x"$line" != x""; then | |
printf '%s' "$line" |