#!/usr/bin/env bash # SPDX-FileCopyrightText: 2022 Robin Vobruba # SPDX-License-Identifier: AGPL-3.0-or-later # # See the output of "$0 -h" for details. # Exit immediately on each error and unset variable; # see: https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/ set -Eeuo pipefail #set -Eeu #script_dir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") APP_NAME="Test runner" # parameters function print_help() { script_name="$(basename "$0")" echo -e "" echo -e "$APP_NAME - Runs all tests and checks for this repo." echo -e "" echo -e "Usage:" echo -e "\t$script_name [OPTION...]" echo -e "Options:" echo -e "\t-h, --help" echo -e "\t\tPrint this usage help and exit" echo -e "Examples:" echo -e "\t$script_name" echo -e "" } # Process command line arguments while [[ $# -gt 0 ]] do arg="$1" shift # $2 -> $1, $3 -> $2, ... case "$arg" in -h|--help) print_help exit 0 ;; -*) # unknown switch >&2 echo "ERROR: Unknown switch '$arg'" exit 1 ;; *) # non-switch POSITIONAL+=("$arg") # save it in an array for later ;; esac done set -- "${POSITIONAL[@]}" # restore positional parameters mvd check_markdown