diff options
author | Aineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi> | 2024-03-05 10:26:58 +0200 |
---|---|---|
committer | Aineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi> | 2024-03-05 10:26:58 +0200 |
commit | a4043f59c2b162502854aa95cfab613a975e7506 (patch) | |
tree | 06abae0a38bcec4071daa730a333ae854034b79e | |
parent | 050bcd11b741520c950123c6a52b8429163c9397 (diff) |
make dev.sh more verbose
-rwxr-xr-x | dev.sh | 85 |
1 files changed, 53 insertions, 32 deletions
@@ -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" |