#!/bin/sh [ x$1 = x ] && echo "\ Small script for running developement tools. Usage: $0 Commands: dev Install developement envoronment pytest Run pytest unittests pylint Do pylint covhtml Make branch coverage report in html format covff Open html coverage report in firefox all Do it all: pytest, coverage report in firefox and pylint install Build poetry package and install it for current user " && exit 0 PIP=`which pipx` [ x$PIP = x ] && PIP=`which pip` [ x$PIP = x ] \ && echo "This scripts needs pipx or pip to install dependencies." \ && exit 1 export DEVSH_PRIN=">>$DEVSH_PRIN" export DEVSH_PROUT="<<$DEVSH_PROUT" echo "\033[32m$DEVSH_PRIN $0 $1 - started.\033[0m" case $1 in install-poetry) $PIP install poetry ;; install-latest-build) $PIP install `ls dist/*.tar.gz -t -c -1 | head -1` \ && echo "For uninstall please use '$PIP uninstall ...'" ;; poetry-dev-deps) PYTHON_KEYRING_BACKEND=keyring.backends.fail.Keyring \ poetry install --no-root ;; dev) $0 install-poetry \ && $0 poetry-dev-deps ;; pytest) poetry run pytest -v ;; pylint) poetry run python3 -m pylint src/sliceitoff/ ;; coverage) poetry run python3 -m coverage run --branch -m pytest -v ;; covhtml) $0 coverage \ && poetry run python3 -m coverage html ;; covff) $0 covhtml \ && firefox htmlcov/index.html ;; all) $0 covff \ && $0 pylint ;; poetry-build) poetry build ;; install) $0 install-poetry \ && $0 poetry-build \ && $0 install-latest-build ;; *) echo "\033[31m$DEVSH_PROUT $0 $1 - unknown command.\033[0m" exit 1 ;; esac STATUS=$? [ $STATUS != 0 ] \ && echo "\033[31m$DEVSH_PROUT $0 $1 - exited with code $STATUS.\033[0m" \ && exit $STATUS echo "\033[32m$DEVSH_PROUT $0 $1 - done.\033[0m"