mirror of
https://github.com/DaoCloud/public-image-mirror.git
synced 2025-08-12 01:17:23 +08:00
Fix fmt-image-match.sh
This commit is contained in:
@@ -4,11 +4,11 @@ function check_match() {
|
|||||||
local image=$1
|
local image=$1
|
||||||
local lines=$2
|
local lines=$2
|
||||||
for line in ${lines}; do
|
for line in ${lines}; do
|
||||||
if [[ "${line}" == *"**" ]]; then
|
if [[ "${line}" == *"/**" ]]; then
|
||||||
if [[ "${image}" == "${line%\*\*}"* ]]; then
|
if [[ "${image}" == "${line%\*\*}"* ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
elif [[ "${line}" == *"*" ]]; then
|
elif [[ "${line}" == *"/*" ]]; then
|
||||||
if [[ "${image}" == "${line%\*}"* ]]; then
|
if [[ "${image}" == "${line%\*}"* ]]; then
|
||||||
if [[ "${image#"${line%\*}"}" != *"/"* ]]; then
|
if [[ "${image#"${line%\*}"}" != *"/"* ]]; then
|
||||||
return
|
return
|
||||||
@@ -20,6 +20,20 @@ function check_match() {
|
|||||||
echo "${image}"
|
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() {
|
function format() {
|
||||||
local file=$1
|
local file=$1
|
||||||
local lines="$(cat "${file}")"
|
local lines="$(cat "${file}")"
|
||||||
@@ -30,8 +44,10 @@ function format() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
for line in ${lines}; do
|
for line in ${lines}; do
|
||||||
if [[ "${line}" == *"*" ]]; then
|
if [[ "${line}" == *"/**" ]]; then
|
||||||
echo ${line}
|
echo "${line}"
|
||||||
|
elif [[ "${line}" == *"/*" ]]; then
|
||||||
|
check_match_more "${line}" "${lines}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user