Created
September 7, 2025 21:45
-
-
Save glektarssza/c8c01041c93d7327716b8d9b6efed554 to your computer and use it in GitHub Desktop.
GTNH Mod Duplication Checker Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git status --porcelain | Select-String -Raw -Pattern '^\?\?' | ForEach-Object { return (($_ -split '^\s*(\?\?)\s+')[1] -split "-", 2)[0]; } | ForEach-Object { return Get-ChildItem -File -Filter "$((Split-Path $_)[-1])*" ".minecraft/mods"; } | Select-Object -Unique | Group-Object -Property { Write-Debug "Inspecting mod file `"$_`"..."; return ([System.Text.RegularExpressions.Regex]::new("(.+?)((\d+\.?){1,3}\d+)[^\d]*").Matches($_.BaseName).Groups[1]); } | Where-Object -Property Count -GE 2 | Select-Object -Property Name, @{Label = "Group"; Expression = { return $_.Group | ForEach-Object { return @{File = $_; Version = [System.Text.RegularExpressions.Regex]::new("(.+?)((\d+\.?){1,3}\d+)[^\d]*").Matches($_).Groups[2] }; } } } | Format-Table -Property @{Label="Mod Name"; Expression={$_.Name.Trim("-")}}, @{Label = "Files"; Expression = { return $_.Group | Join-String -Separator "`n" -Property { return $_.File.BaseName; } } }, @{Label = "Versions"; Expression = { return $_.Group | Join-String -Separator "`n" -Property { return $_.Version; } }; } -Wrap; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment