From ad13f0779eac0ef5f6878f6f6f658e8c77c48068 Mon Sep 17 00:00:00 2001 From: DTB Date: Sat, 2 Sep 2023 10:41:21 -0400 Subject: [PATCH] toki pona dictionary stuff --- toki/toki_common | 12 ++++++++++++ toki/toki_lipunimi | 17 +++++++++++++++++ toki/toki_update | 19 +++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100755 toki/toki_common create mode 100755 toki/toki_lipunimi create mode 100755 toki/toki_update diff --git a/toki/toki_common b/toki/toki_common new file mode 100755 index 0000000..4040cb2 --- /dev/null +++ b/toki/toki_common @@ -0,0 +1,12 @@ +#!/bin/sh + +# this could potentially leave a user with two jasima.json files post config +# change but that's fine +if test -z "$JASIMA" + then test -n "$XDG_CONFIG_HOME" \ + && JASIMA="$XDG_CONFIG_HOME"/tokipona/jasima.json \ + || JASIMA="$HOME"/.tokipona/jasima.json +fi + +test -n "$JASIMA_URL" \ + || JASIMA_URL=https://linku.la/jasima/data.json diff --git a/toki/toki_lipunimi b/toki/toki_lipunimi new file mode 100755 index 0000000..5740209 --- /dev/null +++ b/toki/toki_lipunimi @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e + +test -e toki_common \ + && . ./toki_common \ + || . toki_common + +test -n "$2" \ + && printf 'Usage: %s (lipu)\n' >&2 \ + && exit 64 \ + || true # syexits(3) EX_USAGE + +test -n "$1" \ + && JASIMA="$1" + +dd <"$JASIMA" 2>/dev/null diff --git a/toki/toki_update b/toki/toki_update new file mode 100755 index 0000000..94a8615 --- /dev/null +++ b/toki/toki_update @@ -0,0 +1,19 @@ +#!/bin/sh + +set -e + +test -e toki_common \ + && . ./toki_common \ + || . toki_common + +test -n "$2" \ + && printf 'Usage: %s (lipu nimi)\n' >&2 \ + && exit 64 \ + || true # syexits(3) EX_USAGE + +test -n "$1" \ + && JASIMA_URL="$1" + +mkdir -p "$(dirname "$JASIMA")" + +curl "$JASIMA_URL" -o "$JASIMA"