| 333 | |
| 334 | |
| 335 | def format_rust_files_linux(): |
| 336 | # The find command to locate and format all .rs files in Linux |
| 337 | find_command = 'find . -name "*.rs" -exec rustfmt {} \\;' |
| 338 | |
| 339 | # Execute the command |
| 340 | process = subprocess.Popen( |
| 341 | find_command, |
| 342 | shell=True, |
| 343 | stdout=subprocess.PIPE, |
| 344 | stderr=subprocess.PIPE, |
| 345 | text=True, |
| 346 | ) |
| 347 | |
| 348 | # Get the output and errors |
| 349 | stdout, stderr = process.communicate() |
| 350 | |
| 351 | if process.returncode == 0: |
| 352 | print("Rust files formatted successfully on Linux!") |
| 353 | print(stdout) |
| 354 | else: |
| 355 | print("Error formatting Rust files on Linux:") |
| 356 | print(stderr) |
| 357 | |
| 358 | |
| 359 | def format_rust_files_windows(): |