summaryrefslogtreecommitdiff
path: root/bin/extra/wd
blob: b0e91a09cae11214a3adb36f8cee64ef6a569a9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh
[ "$1" ] && word="$1" || exit 1
shift
dict "$word" $@ |
	sed -e '/^  /!d;s/^  //' |
	sed -e '/^$/d;s/^[^ ].*$/\o033[1;4;34m&\o033[0m/' |

	# foldoc
	sed -e '/^ /s/</\o033[2m/g' -e '/^ /s/>/\o033[0m/g' | 

	# webster
	sed -r -e 's/ \\\<\w+\>\\//g' -e '/^ *\[[^]]*Webster[^]]*\]/d' |
	# replace {} by blue underline
	sed -e '/^ /s/{/\o033[4m/g' -e '/^ /s/}/\o033[0m/g' | 
	tr -d '{}' # remove {} in word definition