Fix fmt-image-match.sh
This commit is contained in:
parent
863d1bbf64
commit
5f93c102a7
|
@ -4,11 +4,11 @@ function check_match() {
|
|||
local image=$1
|
||||
local lines=$2
|
||||
for line in ${lines}; do
|
||||
if [[ "${line}" == *"**" ]]; then
|
||||
if [[ "${line}" == *"/**" ]]; then
|
||||
if [[ "${image}" == "${line%\*\*}"* ]]; then
|
||||
return
|
||||
fi
|
||||
elif [[ "${line}" == *"*" ]]; then
|
||||
elif [[ "${line}" == *"/*" ]]; then
|
||||
if [[ "${image}" == "${line%\*}"* ]]; then
|
||||
if [[ "${image#"${line%\*}"}" != *"/"* ]]; then
|
||||
return
|
||||
|
@ -20,6 +20,20 @@ function check_match() {
|
|||
echo "${image}"
|
||||
}
|
||||
|
||||
function check_match_more() {
|
||||
local image=$1
|
||||
local lines=$2
|
||||
for line in ${lines}; do
|
||||
if [[ "${line}" == *"/**" ]]; then
|
||||
if [[ "${image}" == "${line%\*\*}"* ]]; then
|
||||
return
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
echo "${image}"
|
||||
}
|
||||
|
||||
function format() {
|
||||
local file=$1
|
||||
local lines="$(cat "${file}")"
|
||||
|
@ -30,8 +44,10 @@ function format() {
|
|||
done
|
||||
|
||||
for line in ${lines}; do
|
||||
if [[ "${line}" == *"*" ]]; then
|
||||
echo ${line}
|
||||
if [[ "${line}" == *"/**" ]]; then
|
||||
echo "${line}"
|
||||
elif [[ "${line}" == *"/*" ]]; then
|
||||
check_match_more "${line}" "${lines}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue