Skip to content

Commit

Permalink
Update run.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
Lutra-Fs authored Oct 27, 2024
1 parent 51ddced commit acd56a5
Showing 1 changed file with 1 addition and 37 deletions.
38 changes: 1 addition & 37 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,42 +22,6 @@ sed -i "s|{{CheckTime}}|$DATE|g" tmp/chrome.xml

./util/generator.sh stable-x86 stable-x64 beta-x86 beta-x64 dev-x86 dev-x64 canary-x86 canary-x64

# Function to format XML
format_xml() {
local input=$1
local output=$2

# Read input file and process it
sed '
# Add newline after elements that end with >
s/>/>\n/g
# Remove empty lines
/^[[:space:]]*$/d
' "$input" | awk '
# Initialize indent level
BEGIN { indent = 0 }
# Processing each line
{
# Remove leading/trailing whitespace
gsub(/^[ \t]+|[ \t]+$/, "")
# Decrease indent for closing tags
if (match($0, "^</")) {
indent -= 2
}
# Print the indented line
printf "%*s%s\n", indent, "", $0
# Increase indent for opening tags that are not self-closing
if (match($0, "^<[^/]") && !match($0, "/>$")) {
indent += 2
}
}
' > "$output"
}

# Function to minify XML
minify_xml() {
local input=$1
Expand All @@ -77,7 +41,7 @@ minify_xml() {
}

# Format XML
format_xml "tmp/chrome.xml" "tmp/api/chrome.xml"
cp "tmp/chrome.xml" "tmp/api/chrome.xml"

# Minify XML
minify_xml "tmp/chrome.xml" "tmp/api/chrome.min.xml"
Expand Down

0 comments on commit acd56a5

Please sign in to comment.