{% if not embedded -%}
{% include "bash.sh.j2" %}
{% endif %}

{% macro yj(cache_only=False) -%}
version=$(curl -s https://api.github.com/repos/sclevine/yj/releases/latest | grep tag_name | cut -d: -f2 | tr -d 'v," ')
echo $version
wget --quiet --timestamping https://github.com/sclevine/yj/releases/download/v${version}/yj-linux-amd64
tar -f archive.tar -r yj-linux-amd64
{% if not cache_only -%}
sudo install --mode 0755 --group root --owner root yj-linux-amd64 /usr/local/bin/yj
yj -v && rm -f yj-linux-amd64
{% endif %}
{% endmacro %}

{% block content %}{{ yj(cache_only) }}{% endblock %}
