aboutsummaryrefslogtreecommitdiffstats
path: root/dict
blob: b9ef58c4da669d5387cef070b24a889ed317bad0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/local/bin/bash

URL=https://en.m.wiktionary.org/wiki/
URLT=https://www.wordnik.com/words/WORD#relate
CMD=lynx

function usage {
    echo
    echo "Usage: dic [WORD] [-t (search thesaurus)] [-h (display this help)]"
    echo "  Searches for WORD at wiktionary. If -t is passed, then searches for word at wordnik, using their synonyms feature."
}

if [[ $# -eq 0 ]]; then
  usage
  exit 1
fi

if [[ "$1" = "-t" ]]; then
  URLTx=${URLT/WORD/$2}
  $CMD "$URLTx"
  shift
else
  $CMD "$URL$1"
fi