1
0

toki pona dictionary stuff

This commit is contained in:
dtb 2023-09-02 10:41:21 -04:00
parent 1e42e3f8b2
commit ad13f0779e
3 changed files with 48 additions and 0 deletions

12
toki/toki_common Executable file
View File

@ -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

17
toki/toki_lipunimi Executable file
View File

@ -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

19
toki/toki_update Executable file
View File

@ -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"