clean.ps1 897 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #requires -version 5
  2. <#
  3. .SYNOPSIS
  4. Clean this repository.
  5. .DESCRIPTION
  6. This script cleans this repository interactively, leaving downloaded infrastructure untouched.
  7. Clean operation is interactive to avoid losing new but unstaged files. Press 'c' then [Enter]
  8. to perform the proposed deletions.
  9. .EXAMPLE
  10. Perform default clean operation.
  11. clean.ps1
  12. .EXAMPLE
  13. Clean everything but downloaded infrastructure and VS / VS Code folders.
  14. clean.ps1 -e .vs/ -e .vscode/
  15. #>
  16. [CmdletBinding(PositionalBinding = $false)]
  17. param(
  18. # Other lifecycle targets
  19. [switch]$Help, # Show help
  20. # Capture the rest
  21. [Parameter(ValueFromRemainingArguments = $true)]
  22. [string[]]$GitArguments
  23. )
  24. Set-StrictMode -Version 2
  25. $ErrorActionPreference = 'Stop'
  26. if ($Help) {
  27. Get-Help $PSCommandPath
  28. exit 0
  29. }
  30. git clean -dix -e .dotnet/ -e .tools/ @GitArguments
  31. git checkout -- $(git ls-files -d)