I have this extremely simple powershell script that prepends each line with a number.
$i = 0;
foreach($line in $input)
[string]$i + ":" + $line
git status -s | number
git status -s
As far as I'm aware, you can't preserve the colors output by
git status -s, or any other command output that is piped into PowerShell via StdIn. The color information of the text being piped into the PowerShell function via StdIn is 'lost'.
The only way I can think of adding color back in would be to perform RegEx matches or positional based coloring, using multiple
Write-Host "line section" -ForegroundColor COLOR -NoNewline for each colored section.
The console uses System.IO.StreamReader to accept input via StdIn. Try this command
[Console]::In | Get-Member in PowerShell/ISE.