summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authortv <tv@nomic.retiolum>2013-09-02 16:53:20 +0200
committertv <tv@nomic.retiolum>2013-09-02 16:53:20 +0200
commit78eb0da69229b9d29cc8a9a42678c7664ad5f8b8 (patch)
treea6bfc6ab2a236a1fedd924cb2a146145e81d11fd /util
parentcd2185d7fccb36d0146da751a1d34bf942728794 (diff)
util dic: print usage
Diffstat (limited to 'util')
-rwxr-xr-xutil/bin/dic20
1 files changed, 15 insertions, 5 deletions
diff --git a/util/bin/dic b/util/bin/dic
index aceee6e6..b3dac847 100755
--- a/util/bin/dic
+++ b/util/bin/dic
@@ -4,12 +4,18 @@
# multiple WORDs may be seperated by + like this: multiple+words
set -euf
-# all three are used by GET
-search="$1"
-langlang="${2-en}de"
-lang="de"
-
main() {
+
+ case $# in
+ 1|2) :;; # ok
+ *) usage; exit 23;;
+ esac
+
+ # all three are used by GET
+ search="$1"
+ langlang="${2-en}de"
+ lang="de"
+
GET | simplify | tac
}
@@ -65,4 +71,8 @@ simplify() {
'
}
+usage() {
+ sed -rn '/^# usage:/,/^[^#]/{/^#/{s/# //;p}}' "$0" >&2
+}
+
main "$@"