We have a psake orchestration that prompts a user with the following message before calling 'git clean -xdf':
About to delete all untracked files. Press 'Y' to continue or any other key to cancel.
We'd like to show this prompt ONLY if there are untracked files in the repository that would be removed by running the clean -xdf.
Any suggestions as how to use posh-git to answer the question "are there any untracked changes in the repository?" from PowerShell?
Here is the existing orchestration, for reference...
task CleanAll -description "Runs a git clean -xdf" {
Write-Host "About to delete any uncommitted changes. Press 'Y' to continue or any other key to cancel." -foregroundcolor "yellow"
$continue = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyUp").Character
IF ($continue -eq "Y" -or $continue -eq "y")
{
git clean -xdf
}
ELSE
{
Write-Error "CleanAll canceled."
}
}