From 0ae8d6252055ec842aa6011426ea671335684e57 Mon Sep 17 00:00:00 2001 From: MoonDroid <81515012+moondroidcoder@users.noreply.github.com> Date: Tue, 19 Aug 2025 21:48:16 +0700 Subject: [PATCH] Scripts to organize astc data because its gettin' big and i love alphabetically sorting everything --- organize_astc_data.ps1 | 22 ++++++++++++++++++++++ organize_astc_data.sh | 25 +++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 organize_astc_data.ps1 create mode 100755 organize_astc_data.sh diff --git a/organize_astc_data.ps1 b/organize_astc_data.ps1 new file mode 100644 index 000000000..c3f8187df --- /dev/null +++ b/organize_astc_data.ps1 @@ -0,0 +1,22 @@ +# Organizes astc-compression-data alphabetically because i hate it when it's not organized -zack + +$InputFile = "./astc-compression-data.json" +$OutputFile = "./astc-compression-data.json" + +if (-not (Test-Path $InputFile)) { + Write-Host "❌ File $InputFile not found" + exit 1 +} + +if (-not (Get-Command jq -ErrorAction SilentlyContinue)) { + Write-Host "jq is not installed. Download from https://jqlang.github.io/jq/ or install via:" + Write-Host " winget install jqlang.jq" + exit 1 +} + +jq '. + | .custom = ( .custom | sort_by(.asset) ) + | .excludes = ( .excludes | sort ) +' $InputFile | Out-File -Encoding utf8 $OutputFile + +Write-Host "✅ Sorted JSON written to $OutputFile WOOHOOO !!" diff --git a/organize_astc_data.sh b/organize_astc_data.sh new file mode 100755 index 000000000..051e36408 --- /dev/null +++ b/organize_astc_data.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Organizes astc-compression-data alphabetically because i hate it when it's not organized -zack + +INPUT_FILE="./astc-compression-data.json" +OUTPUT_FILE="./astc-compression-data.json" + +# Check jq +if ! command -v jq &> /dev/null; then + echo "jq is not installed. Install it with:" + echo " macOS: brew install jq" + echo " Linux (Debian/Ubuntu): sudo apt-get install jq" + exit 1 +fi + +if [ ! -f "$INPUT_FILE" ]; then + echo "❌ File $INPUT_FILE not found" + exit 1 +fi + +jq '. + | .custom = ( .custom | sort_by(.asset) ) + | .excludes = ( .excludes | sort ) +' "$INPUT_FILE" > "$OUTPUT_FILE".tmp && mv "$OUTPUT_FILE".tmp "$OUTPUT_FILE" + +echo "✅ Sorted JSON written to $OUTPUT_FILE WOOHOOO !!"