diff options
-rwxr-xr-x | dic | 25 |
1 files changed, 16 insertions, 9 deletions
@@ -1,19 +1,26 @@ #! /bin/sh -# usage: dic WORD [LANG] +# usage: dic [--lang=LANG] WORD... # where LANG may be one of en, fr, es, it, ch, ru, pt, pl # multiple WORDs may be seperated by + like this: multiple+words set -euf main() { - case $# in - 1|2) :;; # ok - *) usage; exit 23;; - esac - - search=$1 - lang=de - lp=${2-en}de + _args=$(getopt -n "$0" -s sh \ + -o l: \ + -l lang: \ + -- "$@") + if \test $? != 0; then exit 1; fi + eval set -- "$_args" + unset _args + lang=en + while :; do case $1 in + -l|--lang) lang=$2; shift 2;; + --) shift; break;; + esac; done + + search=$* + lp=${lang}de GET | simplify | tac } |