Colorize Subversion SVN by Bishop 32 months ago (modification of post by Bishop view diff)
View followups from Bishop | diff | embed code: <script type="text/javascript" src="http://PoshCode.org/embed/1143"></script>download | new post
Colorize Subversion SVN STAT, UPDATE and DIFF (without params) output.
Here’s a PowerShell functions that you can use to make those numerous SVN commands you run every day via the PowerShell CLI a little easier to read by adding colors.
- # draw output
- function drawlines($colors, $lines) {
- if (!$lines) { return }
- foreach ($line in $lines) {
- $color = $colors[[string]$line[0]]
- if ($color) {
- write-host $line -Fore $color
- } else {
- write-host $line
- }
- }
- }
- # svn stat
- function ss {
- drawlines @{ "A"="Magenta"; "D"="Red"; "C"="Yellow"; "G"="Blue"; "M"="Cyan"; "U"="Green"; "?"="DarkGray"; "!"="DarkRed" } (svn stat)
- }
- # svn update
- function su {
- drawlines @{ "A"="Magenta"; "D"="Red"; "U"="Green"; "C"="Yellow"; "G"="Blue"; } (svn up)
- }
- # svn diff
- function sd {
- drawlines @{ "@"="Magenta"; "-"="Red"; "+"="Green"; "="="DarkGray"; } (svn diff)
- }
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.
PowerShell Code Repository