From 883e34b80449282ecbb8fd4b1717b32c56163e89 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 28 Jun 2018 14:14:23 +0200 Subject: bin/wtf: enable full-path search --- bin/wtf | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/wtf b/bin/wtf index b42cd15..1963cff 100755 --- a/bin/wtf +++ b/bin/wtf @@ -2,7 +2,9 @@ # shellcheck disable=SC2119,SC2120 -wget -qO- 'https://pkgapi.arch32.tyzoid.com/esearch/'"$*"'.xml' | \ +search="$*" + +wget -qO- 'https://pkgapi.arch32.tyzoid.com/esearch/'"${search##*/}"'.xml' | \ awk ' BEGIN { package=""; @@ -35,4 +37,10 @@ wget -qO- 'https://pkgapi.arch32.tyzoid.com/esearch/'"$*"'.xml' | \ file[++filelen] = gensub(/<[^>]+>/, "", "g", $1); } } - ' + ' | \ + if printf '%s\n' "${search}" | \ + grep -q '/'; then + grep -w "${search}" || true + else + cat + fi -- cgit v1.2.3-70-g09d2