From 556797400b94070f008ba003419622916ed10bda Mon Sep 17 00:00:00 2001 From: ars Date: Wed, 28 Oct 2020 18:51:59 +0000 Subject: Remove old things that aren't doing anything, fix/add comments. --- oedquery.sh | 13 ++++--------- 1 file 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 - " -- cgit v1.2.3