From: Gustav Eek Date: Fri, 6 Sep 2019 17:58:01 +0000 (+0200) Subject: [folkets] Initail on Fokets Lexikon wrapper. X-Git-Url: https://git.g-eek.se/?a=commitdiff_plain;h=8a947059a9fb5ed1b40ef9c734b04491e8f8c2f7;p=users%2Fgustav%2Fscripts.git [folkets] Initail on Fokets Lexikon wrapper. The program works as expected. Some improvements possible: * Use w3m also for calling (limit complexity) * Consider make a short version for std out * Force w3m quit without confirmation (that is how mutt is using w3m) --- diff --git a/Makefile b/Makefile index 7605272..1f707f9 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,7 @@ confluence-tk \ json2yaml \ yaml2json \ ip-check \ +folkets \ bash-completion = \ diff --git a/folkets b/folkets new file mode 100755 index 0000000..9f69e81 --- /dev/null +++ b/folkets @@ -0,0 +1,29 @@ +#!/bin/bash + +# provides translatsions with Folkets lexicon + +set -e + +BASE="https://folkets-lexikon.csc.kth.se" +LOC="folkets/service" +LANG="both" +INTERFACE="sv" +LOG="/tmp/folkets/error.out" +HTML="/tmp/folkets/out.html" + +word="$1" + +url="$BASE/$LOC" + +form=" + --data-urlencode word=$word + --data-urlencode lang=$LANG + --data-urlencode interface=$INTERFACE +" + +mkdir -p $(dirname $LOG $HTML) + +curl -v -L --get ${form} ${url} 2> $LOG | w3m -T text/html + +# Consider make also the call with w3m +# Consider put on stdout