fix loader for dash
This commit is contained in:
parent
98e917a402
commit
3ba708dcfb
|
@ -1,10 +1,24 @@
|
|||
#!/bin/sh
|
||||
|
||||
load_reporter_with_prefix () {
|
||||
local prefix=$1
|
||||
local file=$2
|
||||
# dash will error if this variable is defined as `local`
|
||||
content=$(sed \
|
||||
-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"
|
||||
}
|
||||
|
||||
load_metric_with_prefix () {
|
||||
local prefix=$1
|
||||
local file=$2
|
||||
|
||||
local content=$(sed \
|
||||
# dash will error if this variable is defined as `local`
|
||||
content=$(sed \
|
||||
-e 's/^[[:space:]]*\(init[ ]*()[ ]*{\)/'"$prefix"'\1/' \
|
||||
-e 's/^[[:space:]]*\(collect[ ]*()[ ]*{\)/'"$prefix"'\1/' \
|
||||
-e 's/^[[:space:]]*\(terminate[ ]*()[ ]*{\)/'"$prefix"'\1/' \
|
||||
|
@ -12,15 +26,3 @@ load_metric_with_prefix () {
|
|||
|
||||
eval "$content"
|
||||
}
|
||||
|
||||
load_reporter_with_prefix () {
|
||||
local prefix=$1
|
||||
local file=$2
|
||||
local content=$(sed \
|
||||
-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"
|
||||
}
|
Loading…
Reference in New Issue