#!/bin/bash
-function pushd () {
+pushd () {
command pushd "$@" > /dev/null
}
-function popd () {
+popd () {
command popd "$@" > /dev/null
}
-function check_cpp_tool() {
- which clang-format-3.9
- if [[ $? -ne 0 ]]; then
+command_exists() {
+ command -v $1 > /dev/null 2>&1
+}
+
+check_cpp_tool() {
+ if ! command_exists clang-format-3.9; then
echo "Error: clang-format-3.9 is not available."
echo " Please install clang-format-3.9."
exit 1
fi
}
-function check_python_tool() {
- which yapf
- if [[ $? -ne 0 ]]; then
+check_python_tool() {
+ if ! command_exists yapf; then
echo "Error: yapf is not available."
echo " Please install yapf."
exit 1
fi
}
-function check_cpp_files() {
+check_cpp_files() {
DIRECTORIES_TO_BE_TESTED=$1
DIRECTORIES_NOT_TO_BE_TESTED=$2
done
}
-function check_python_files() {
+check_python_files() {
DIRECTORIES_TO_BE_TESTED=$1
DIRECTORIES_NOT_TO_BE_TESTED=$2