From 3d6dd8fa43e209180e1d85d742e2d62daa3b18a1 Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Sat, 20 Aug 2022 07:49:23 +0200 Subject: [PATCH] Refactor repocheck --- repocheck.sh | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/repocheck.sh b/repocheck.sh index 491a31b..e2ded90 100755 --- a/repocheck.sh +++ b/repocheck.sh @@ -14,25 +14,32 @@ set -e +has() { + what="$1" + type "$what" >/dev/null 2>&1 && return 0 || return 1 +} + red() { - tput setaf 1 + has tput && tput setaf 1 || true # We are OK with dumb terminals echo "$@" - tput sgr0 + has tput && tput sgr0 || true } -has_reuse=$(type reuse >/dev/null 2>&1 && echo true || echo false) -if $has_reuse; then +if has reuse; then reuse lint else red "REUSE tool not found, skipping" fi -has_mypy=$(type mypy >/dev/null 2>&1 && echo true || echo false) -if $has_mypy; then +if has mypy; then mypy *.py else red "Mypy not found, skipping" fi -./test.py +if has python3; then + ./test.py +else + red 'WTF no python!' +fi