| 357 | |
| 358 | |
| 359 | def format_rust_files_windows(): |
| 360 | # PowerShell command to format all .rs files recursively in Windows |
| 361 | ps_command = ( |
| 362 | "Get-ChildItem -Recurse -Filter *.rs | ForEach-Object { rustfmt $_.FullName }" |
| 363 | ) |
| 364 | |
| 365 | # Execute the PowerShell command |
| 366 | process = subprocess.Popen( |
| 367 | ["powershell", "-Command", ps_command], |
| 368 | stdout=subprocess.PIPE, |
| 369 | stderr=subprocess.PIPE, |
| 370 | text=True, |
| 371 | ) |
| 372 | |
| 373 | # Get the output and errors |
| 374 | stdout, stderr = process.communicate() |
| 375 | |
| 376 | if process.returncode == 0: |
| 377 | print("Rust files formatted successfully on Windows!") |
| 378 | print(stdout) |
| 379 | else: |
| 380 | print("Error formatting Rust files on Windows:") |
| 381 | print(stderr) |
| 382 | |
| 383 | |
| 384 | def run(): |