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"