]> gitweb.fluxo.info Git - scripts.git/commitdiff
Feat: dict wrapper
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 4 Dec 2020 21:14:35 +0000 (18:14 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 4 Dec 2020 21:14:35 +0000 (18:14 -0300)
dict [new file with mode: 0755]

diff --git a/dict b/dict
new file mode 100755 (executable)
index 0000000..6d58fe9
--- /dev/null
+++ b/dict
@@ -0,0 +1,20 @@
+#!/bin/bash
+#
+# Dictionary wrapper.
+#
+
+# Parameters
+BASENAME="`basename $0`"
+DICT="/usr/bin/dict"
+
+# Dispatch
+if [ -x "$DICT" ]; then
+  $DICT "$@"
+else
+  if which surfraw &> /dev/null; then
+    surfraw wiktionary "$@"
+  else
+    echo "error: no suitable dictionary found in the system"
+    exit 1
+  fi
+fi