mirror of
https://github.com/DaoCloud/public-image-mirror.git
synced 2025-08-08 18:18:55 +08:00
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user