From 05f9d4f3bd6b96c2afcab74e7b6d717bd0009133 Mon Sep 17 00:00:00 2001 From: Matthew Esposito Date: Thu, 28 Dec 2023 15:52:54 -0500 Subject: [PATCH] Add count to update_oauth_resources.sh --- scripts/update_oauth_resources.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/update_oauth_resources.sh b/scripts/update_oauth_resources.sh index 229d5b6..8a0053f 100755 --- a/scripts/update_oauth_resources.sh +++ b/scripts/update_oauth_resources.sh @@ -26,11 +26,13 @@ echo "// Filled in with real app versions" >> "$filename" # Open the array in the source file echo "pub static IOS_APP_VERSION_LIST: &[&str; $ios_app_count] = &[" >> "$filename" +num=0 # Append the version list to the source file echo "$ios_version_list" | while IFS= read -r line; do + num=$((num+1)) echo " \"$line\"," >> "$filename" - echo -e "Fetched \e[34m$line\e[0m." + echo -e "[$num/$ios_app_count] Fetched \e[34m$line\e[0m." done # Close the array in the source file @@ -63,13 +65,16 @@ echo -e "Fetching \e[32m$android_count Android app versions...\e[0m" # Append to the source file echo "pub static ANDROID_APP_VERSION_LIST: &[&str; $android_count] = &[" >> "$filename" +num=0 + # For each in versions, curl the page and extract the build number echo "$versions" | while IFS= read -r line; do + num=$((num+1)) fetch_page=$(curl -s "$line") build=$(echo "$fetch_page" | rg "\((\d+)\)" --only-matching -r "\$1" | head -n1) version=$(echo "$fetch_page" | rg "Reddit (20\d{2}\.\d+\.\d+)" --only-matching -r "\$1" | head -n1) echo " \"Version $version/Build $build\"," >> "$filename" - echo -e "Fetched \e[32mVersion $version/Build $build\e[0m" + echo -e "[$num/$android_count] Fetched \e[32mVersion $version/Build $build\e[0m" done # Close the array in the source file @@ -86,10 +91,13 @@ echo -e "Fetching \e[34m$ios_count iOS versions...\e[0m" # Append to the source file echo "pub static IOS_OS_VERSION_LIST: &[&str; $ios_count] = &[" >> "$filename" +num=0 + # For each in versions, curl the page and extract the build number echo "$table" | while IFS= read -r line; do + num=$((num+1)) echo " \"$line\"," >> "$filename" - echo -e "Fetched $line\e[0m" + echo -e "[$num/$ios_count] Fetched $line\e[0m" done # Close the array in the source file