Files

31 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
launcher="$(readlink -f -- "${BASH_SOURCE[0]}")"
root="$(cd -- "$(dirname -- "$launcher")/.." && pwd)"
if [[ "${1:-}" == --update ]]; then
shift
exec python3 "$root/scripts/update.py" "$@"
fi
# Ein Aufruf verwendet auch während eines Updates eine vollständige Laufzeit.
if [[ -L "$root/.runtime/current" ]]; then
release="$(readlink -f -- "$root/.runtime/current")"
export JR_EINVOICE_MUSTANG_JAR="$release/Mustang-CLI.jar"
python="$release/venv/bin/python"
else
python="$root/.venv/bin/python"
fi
export JR_EINVOICE_HOME="${JR_EINVOICE_HOME:-$root/private}"
export JR_EINVOICE_PRESETS="${JR_EINVOICE_PRESETS:-$root/private/presets}"
if [[ "$(basename -- "$0")" == einvoice-ui || "${1:-}" == --gui ]]; then
if [[ "${1:-}" == --gui ]]; then shift; fi
if ! "$python" -I -c 'from PySide6.QtPdfWidgets import QPdfView' 2>/dev/null; then
echo 'Oberfläche fehlt. Einmalig: einvoice --update --apply --with-gui' >&2
exit 1
fi
exec "$python" -I -m jr_einvoice.gui "$@"
fi
if [[ "$(basename -- "$0")" == jr-einvoice ]]; then
exec "$python" -I -c 'from jr_einvoice.cli import app; app()' "$@"
fi
exec "$python" -I -m jr_einvoice.quick_cli "$@"