summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi>2024-03-05 10:26:58 +0200
committerAineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi>2024-03-05 10:26:58 +0200
commita4043f59c2b162502854aa95cfab613a975e7506 (patch)
tree06abae0a38bcec4071daa730a333ae854034b79e
parent050bcd11b741520c950123c6a52b8429163c9397 (diff)
make dev.sh more verbose
-rwxr-xr-xdev.sh85
1 files 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"