summaryrefslogtreecommitdiff
path: root/oedquery.sh
diff options
context:
space:
mode:
authorars <asav1410@gmail.com>2020-10-28 18:51:59 +0000
committerars <asav1410@gmail.com>2020-10-28 18:51:59 +0000
commit556797400b94070f008ba003419622916ed10bda (patch)
tree6edeebe991f6e0849bbaebf8ed91ebbfa53da7e0 /oedquery.sh
parent91de369f6d69a61d3bc1e58420b322570155a6ac (diff)
Remove old things that aren't doing anything, fix/add comments.
Diffstat (limited to 'oedquery.sh')
-rwxr-xr-xoedquery.sh13
1 files changed, 4 insertions, 9 deletions
diff --git a/oedquery.sh b/oedquery.sh
index 864558a..88a4aae 100755
--- a/oedquery.sh
+++ b/oedquery.sh
@@ -2,16 +2,9 @@
read word
word=$(echo $word | tr '[:upper:]' '[:lower:]')
-# Create array of variable to read from config file
-config=(
- appId
- appKey
- language
- maxSynonyms
-)
# curl options
OPTS='--silent -L -H "app_id: $appId" -H "app_key: $appKey"'
-
+# read config file
source oedquery.conf
# function to provide data to a for loop
@@ -19,6 +12,7 @@ _jq() {
echo ${json} | base64 --decode | jq -r ${1}
}
+# Get data from oed for given word
_getdata() {
# Take everything after final space as the requested word (assuming everything before the last space is a flag)
word=$(echo $word | sed 's/.* //')
@@ -36,7 +30,7 @@ _getdata() {
exit
fi
- # get definition of headword if it exists
+ # get headword if it exists
headWord=$(echo $result | jq '.results[0].lexicalEntries[0].inflectionOf[0].id')
if [ "$headWord" == "null" ]
then
@@ -56,6 +50,7 @@ _getdata() {
# Return definition for the first sense of each lexical entry and create output string
_define() {
_getdata
+ # If requesting word of the day then output the word too
if [[ $wod == true ]]
then
output="$output $word - "