# Function to install packwiz and add it to the system path function Install-Packwiz { # Download packwiz executable Invoke-WebRequest -Uri "https://seafsh.cc/u/d4R3lH.exe" -OutFile "packwiz.exe" # Move packwiz executable to a system directory Move-Item -Path ".\packwiz.exe" -Destination "${env:ProgramFiles}\packwiz\packwiz.exe" # Add packwiz directory to the system path $path = [Environment]::GetEnvironmentVariable("Path", "Machine") $packwizPath = "${env:ProgramFiles}\packwiz" if ($path -notlike "*$packwizPath*") { [Environment]::SetEnvironmentVariable("Path", "$path;$packwizPath", "Machine") } # Verify installation & "${env:ProgramFiles}\packwiz\packwiz.exe" --version } # Function to create symlink for pre-commit hook function Create-Symlink { # Check if .git/hooks directory exists $gitHooksDir = "$PSScriptRoot\.git\hooks" if (-not (Test-Path $gitHooksDir)) { Write-Error "Error: .git/hooks directory does not exist" exit 1 } # Create symlink for pre-commit hook New-Item -ItemType SymbolicLink -Path "$gitHooksDir\pre-commit" -Target "$PSScriptRoot\scripts\hooks\pre-commit-windows" -Force } # Main function function Main { # Install packwiz Install-Packwiz # Create symlink for pre-commit hook Create-Symlink Write-Host "Script execution completed successfully!" } # Execute main function Main