diff options
author | John Ankarstrom <john@ankarstrom.se> | 2021-07-02 15:18:34 +0200 |
---|---|---|
committer | John Ankarstrom <john@ankarstrom.se> | 2021-07-02 15:18:34 +0200 |
commit | 5d4777313eed7a4c777fea2bd316ff233fb59af1 (patch) | |
tree | ef24d1c908e0b4d8c93f71fc6107e357d8de15ed /git-s | |
parent | 52459d675081abc13a502d08d35768338d787867 (diff) | |
download | xutil-5d4777313eed7a4c777fea2bd316ff233fb59af1.tar.gz |
Add 'git-s' utility
Diffstat (limited to 'git-s')
-rwxr-xr-x | git-s | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -0,0 +1,20 @@ +#!/bin/sh + +# git-s -- selection-friendly git-status + +git status -s | perl -ne ' + push @{$x{$1}}, $2 if /^(.). (.*)/; + push @{$y{$1}}, $2 if /^.(.) (.*)/; + END { + delete $x{"?"}; + for ([">" => \%x], ["." => \%y]) { + ($n, $h) = @$_; + for (sort keys %$h) { + next if $_ eq " "; + print "$n$_"; + print " $_" for @{$h->{$_}}; + print "\n"; + } + } + } +' |