Review part 2.

This commit is contained in:
Andreas Grimm 2019-03-11 09:27:09 +01:00
parent 2cca88ed8d
commit 3fccd9615d
3 changed files with 9 additions and 9 deletions

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# load utils # load utils
for util in ${PWD}/lib/utils/*.sh; do for util in ${DIR}/lib/utils/*.sh; do
. $util . $util
done done
@ -16,10 +16,10 @@ main_defaults () {
DEFAULT_REPORTER=stdout DEFAULT_REPORTER=stdout
fi fi
if [ -z $CUSTOM_REPORTERS_PATH ]; then if [ -z $CUSTOM_REPORTERS_PATH ]; then
CUSTOM_REPORTERS_PATH=${PWD}/reporters/custom CUSTOM_REPORTERS_PATH=${DIR}/reporters/custom
fi fi
if [ -z $CUSTOM_METRICS_PATH ]; then if [ -z $CUSTOM_METRICS_PATH ]; then
CUSTOM_METRICS_PATH=${PWD}/metrics/custom CUSTOM_METRICS_PATH=${DIR}/metrics/custom
fi fi
} }

View File

@ -2,7 +2,7 @@
get_available_reporters () { get_available_reporters () {
local result local result
for file in `ls ${PWD}/reporters/*.sh $CUSTOM_REPORTERS_PATH/*.sh 2> /dev/null`; do for file in `ls ${DIR}/reporters/*.sh $CUSTOM_REPORTERS_PATH/*.sh 2> /dev/null`; do
local filename=$(basename $file) local filename=$(basename $file)
local reporter=${filename%.*} local reporter=${filename%.*}
result=$(echo "$result $reporter") result=$(echo "$result $reporter")
@ -12,7 +12,7 @@ get_available_reporters () {
get_available_metrics () { get_available_metrics () {
local result local result
for file in `ls ${PWD}/metrics/*.sh $CUSTOM_METRICS_PATH/*.sh 2> /dev/null`; do for file in `ls ${DIR}/metrics/*.sh $CUSTOM_METRICS_PATH/*.sh 2> /dev/null`; do
local filename=$(basename $file) local filename=$(basename $file)
local metric=${filename%.*} local metric=${filename%.*}
# register metric # register metric
@ -26,7 +26,7 @@ load_reporter_with_prefix () {
local name=$2 local name=$2
local file local file
for dir in $CUSTOM_REPORTERS_PATH ${PWD}/reporters; do for dir in $CUSTOM_REPORTERS_PATH ${DIR}/reporters; do
if [ -f $dir/$name.sh ]; then if [ -f $dir/$name.sh ]; then
file=$dir/$name.sh file=$dir/$name.sh
break break
@ -53,7 +53,7 @@ load_metric_with_prefix () {
local name=$2 local name=$2
local file local file
for dir in $CUSTOM_METRICS_PATH ${PWD}/metrics; do for dir in $CUSTOM_METRICS_PATH ${DIR}/metrics; do
if [ -f $dir/$name.sh ]; then if [ -f $dir/$name.sh ]; then
file=$dir/$name.sh file=$dir/$name.sh
break break

View File

@ -4,7 +4,7 @@
LC_ALL=en_US.UTF-8 LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8 LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8 LANGUAGE=en_US.UTF-8
PWD=$(dirname "$0") DIR=$(dirname "$0")
usage () { usage () {
echo " Usage: $0 [-d] [-h] [-v] [-c] [-m] [-r] [-i] [-C] [-u]" echo " Usage: $0 [-d] [-h] [-v] [-c] [-m] [-r] [-i] [-C] [-u]"
@ -91,7 +91,7 @@ while [ $# -gt 0 ]; do
done done
# run # run
. ${PWD}/lib/main.sh . ${DIR}/lib/main.sh
if [ $opt_do_update = true ]; then if [ $opt_do_update = true ]; then
if ! command_exists git; then if ! command_exists git; then