Skip to content

Commit 4c625e2

Browse files
committed
ci: optimize whois script generation
1 parent f5a103b commit 4c625e2

3 files changed

Lines changed: 639 additions & 176 deletions

File tree

.github/scripts/bl-format.sh

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -755,9 +755,9 @@ run()
755755
# Configure sort options
756756
#
757757
# Builds the options array for the `sort` command based on user settings:
758-
# - If `argSortParallel` is valid number and the system supports it, enable parallel sorting with that value.
759-
# - If `argSortBufferSize` is set, apply it as the sort buffer size (-S).
760-
# - Log what gets enabled or warns if values are invalid or unsupported.
758+
# If `argSortParallel` is valid number and the system supports it, enable parallel sorting with that value.
759+
# If `argSortBufferSize` is set, apply it as the sort buffer size (-S).
760+
# Log what gets enabled or warns if values are invalid or unsupported.
761761
# #
762762

763763
configure_sort_options( )
@@ -825,6 +825,7 @@ extract_ip_entry( )
825825
# Sort Results
826826
#
827827
# @usage sort_results < "${file_ipset_target}" > "${file_ipset_target}.sort"
828+
# grep -vE '^[[:space:]]*(#|;|$)' "${file_ipset_target}" | sort_results > "${file_ipset_target}.sort"
828829
# #
829830
830831
sort_results()
@@ -1107,6 +1108,7 @@ filter_valid_ip_entries()
11071108
11081109
while IFS= read -r _fnValidateLine || [ -n "${_fnValidateLine}" ]; do
11091110
[ -z "${_fnValidateLine}" ] && continue
1111+
11101112
if [ "${argIncludeComments}" = "true" ]; then
11111113
_fnValidateEntry=$(extract_ip_entry "${_fnValidateLine}")
11121114
@@ -1157,9 +1159,9 @@ fi
11571159

11581160
# #
11591161
# Count file statistics
1160-
# - IPv4 CIDR contributes all IPv4 addresses in the subnet
1161-
# - IPv6 CIDR contributes one entry (do not expand)
1162-
# - Single IPv4/IPv6 contributes one entry
1162+
# IPv4 CIDR contributes all IPv4 addresses in the subnet
1163+
# IPv6 CIDR contributes one entry (do not expand)
1164+
# Single IPv4/IPv6 contributes one entry
11631165
# #
11641166

11651167
count_ip_stats( )
@@ -1997,6 +1999,12 @@ download_list_fallback()
19971999

19982000
cat "${_fnArgLocalFile}" > "${_fnFileTemp}"
19992001

2002+
# #
2003+
# Running sed
2004+
# #
2005+
2006+
info " ✴️ Performing sed operations on ${bluel}${_fnFileTemp}${greym}"
2007+
20002008
# #
20012009
# Perform sed actions on downloaded file.
20022010
# #
@@ -2022,6 +2030,7 @@ download_list_fallback()
20222030
else
20232031
# remove inline comments (strip ' # comment' or ' ; comment' from end of lines ; collapse whitespace, trim)
20242032
sed -i 's/[[:space:]]*[#;].*$//' "${_fnFileTemp}"
2033+
20252034
# collapse multiple whitespace into a single space
20262035
sed -i 's/[[:space:]]\+/ /g' "${_fnFileTemp}"
20272036
fi
@@ -2032,10 +2041,14 @@ download_list_fallback()
20322041
# remove empty lines (after trimming/comment removal)
20332042
sed -i '/^$/d' "${_fnFileTemp}"
20342043

2035-
# drop malformed entries before sorting (optional trusted-input fast path)
2044+
# #
2045+
# Drop malformed entries before sorting (optional trusted-input fast path)
2046+
# #
2047+
20362048
if [ "${argTrustedInput}" = "true" ]; then
20372049
info " ⚡ Trusted input mode enabled; skipping per-line IP validation"
20382050
else
2051+
info " ✴️ Verify valid ip entries in ${bluel}${_fnFileTemp}${greym}. This may take some time."
20392052
filter_valid_ip_entries "${_fnFileTemp}"
20402053
fi
20412054

0 commit comments

Comments
 (0)