From a4043f59c2b162502854aa95cfab613a975e7506 Mon Sep 17 00:00:00 2001 From: Aineopintojen-harjoitustyo-Algoritmit-j Date: Tue, 5 Mar 2024 10:26:58 +0200 Subject: make dev.sh more verbose --- dev.sh | 85 +++++++++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 53 insertions(+), 32 deletions(-) diff --git a/dev.sh b/dev.sh index 4c53e9a..04c2b55 100755 --- a/dev.sh +++ b/dev.sh @@ -1,4 +1,5 @@ #!/bin/sh + [ x$1 = x ] && echo "\ Pieni ja kevyt skripti helppoa kehitystyökalujen ajoa varten. @@ -15,35 +16,55 @@ covff Tee html haarakattavuusraportti ja avaa se firefoxissa all Sama kuin '$0 covff && $0 pylint' " && exit 0 -[ $1 = install ] \ - && PYTHON_KEYRING_BACKEND=keyring.backends.fail.Keyring \ - poetry install --no-root \ - && exit 0 - -[ $1 = pytest ] \ - && poetry run pytest -v \ - && exit 0 - -[ $1 = pylint ] \ - && poetry run python3 -m pylint src/miinaharava/ \ - && exit 0 - -[ $1 = covhtml ] \ - && poetry run python3 -m coverage run --branch -m pytest -v \ - && poetry run python3 -m coverage html \ - && exit 0 - -[ $1 = covxml ] \ - && poetry run python3 -m coverage run --branch -m pytest -v \ - && poetry run python3 -m coverage xml \ - && exit 0 - -[ $1 = covff ] \ - && poetry run python3 -m coverage run --branch -m pytest -v \ - && poetry run python3 -m coverage html \ - && firefox htmlcov/index.html \ - -[ $1 = all ] && poetry run python3 -m coverage run --branch -m pytest -v \ - && poetry run python3 -m coverage html \ - && firefox htmlcov/index.html \ - && poetry run python3 -m pylint src/miinaharava/ +echo "\033[32m>>> $0 $1 - started.\033[0m" + +case $1 in + + install) + PYTHON_KEYRING_BACKEND=keyring.backends.fail.Keyring \ + poetry install --no-root + ;; + + pytest) + poetry run pytest -v + ;; + + pylint) + poetry run python3 -m pylint src/miinaharava/ + ;; + + covhtml) + poetry run python3 -m coverage run --branch -m pytest -v \ + && poetry run python3 -m coverage html + ;; + + covxml) + poetry run python3 -m coverage run --branch -m pytest -v \ + && poetry run python3 -m coverage xml + ;; + + covff) + poetry run python3 -m coverage run --branch -m pytest -v \ + && poetry run python3 -m coverage html \ + && firefox htmlcov/index.html + ;; + + all) poetry run python3 -m coverage run --branch -m pytest -v \ + && poetry run python3 -m coverage html \ + && firefox htmlcov/index.html \ + && poetry run python3 -m pylint src/miinaharava/ + ;; + + *) + echo "\033[31m<<< $0 $1 - unknown command.\033[0m" + exit 1 + ;; +esac + +STATUS=$? + +[ $STATUS != 0 ] \ + && echo "\033[31m<<< $0 $1 - exited with code $STATUS.\033[0m" \ + && exit $STATUS + +echo "\033[32m<<< $0 $1 - done.\033[0m" -- cgit v1.2.3