mirror of
https://github.com/pstadler/metrics.sh.git
synced 2025-02-28 05:49:12 -05:00
fix loader
This commit is contained in:
parent
6f8e87208c
commit
00db88320c
@ -5,10 +5,10 @@ load_metric_with_prefix () {
|
||||
local file=$2
|
||||
|
||||
local content=$(sed \
|
||||
-e "s/^\s*\(init[ ]*()[ ]*{\)/${prefix}\1/" \
|
||||
-e "s/^\s*\(collect[ ]*()[ ]*{\)/${prefix}\1/" \
|
||||
-e "s/^\s*\(terminate[ ]*()[ ]*{\)/${prefix}\1/" \
|
||||
-e "s/^\s*\(docs[ ]*()[ ]*{\)/${prefix}\1/" $file)
|
||||
-e "s/^[[:space:]]*\(init[ ]*()[ ]*{\)/${prefix}\1/" \
|
||||
-e "s/^[[:space:]]*\(collect[ ]*()[ ]*{\)/${prefix}\1/" \
|
||||
-e "s/^[[:space:]]*\(terminate[ ]*()[ ]*{\)/${prefix}\1/" \
|
||||
-e "s/^[[:space:]]*\(docs[ ]*()[ ]*{\)/${prefix}\1/" $file)
|
||||
|
||||
eval "$content"
|
||||
}
|
||||
@ -17,10 +17,10 @@ load_reporter_with_prefix () {
|
||||
local prefix=$1
|
||||
local file=$2
|
||||
local content=$(sed \
|
||||
-e "s/^\s*\(init[ ]*()[ ]*{\)/${prefix}\1/" \
|
||||
-e "s/^\s*\(report[ ]*()[ ]*{\)/${prefix}\1/" \
|
||||
-e "s/^\s*\(terminate[ ]*()[ ]*{\)/${prefix}\1/" \
|
||||
-e "s/^\s*\(docs[ ]*()[ ]*{\)/${prefix}\1/" $file)
|
||||
-e "s/^[[:space:]]*\(init[ ]*()[ ]*{\)/${prefix}\1/" \
|
||||
-e "s/^[[:space:]]*\(report[ ]*()[ ]*{\)/${prefix}\1/" \
|
||||
-e "s/^[[:space:]]*\(terminate[ ]*()[ ]*{\)/${prefix}\1/" \
|
||||
-e "s/^[[:space:]]*\(docs[ ]*()[ ]*{\)/${prefix}\1/" $file)
|
||||
|
||||
eval "$content"
|
||||
}
|
11
metrics.sh
11
metrics.sh
@ -10,11 +10,6 @@ LC_ALL=en_US.UTF-8
|
||||
LANG=en_US.UTF-8
|
||||
LANGUAGE=en_US.UTF-8
|
||||
|
||||
# handle opts
|
||||
opts_spec=":dhvr:i:"
|
||||
opt_docs=false
|
||||
opt_verbose=false
|
||||
|
||||
usage () {
|
||||
echo " Usage: $0 [-d] [-h] [-v] [-m metrics] [-r reporter] [-i interval]"
|
||||
}
|
||||
@ -34,6 +29,10 @@ help () {
|
||||
echo
|
||||
}
|
||||
|
||||
# handle opts
|
||||
opt_docs=false
|
||||
opt_verbose=false
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
-m|--metrics)
|
||||
@ -86,7 +85,7 @@ main_load
|
||||
verbose "Available metrics: $__AVAILABLE_METRICS"
|
||||
verbose "Available reporters: $__AVAILABLE_REPORTERS"
|
||||
|
||||
if [ "$opt_docs" = true ]; then
|
||||
if [ $opt_docs = true ]; then
|
||||
main_docs
|
||||
exit
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user