From: Nicolas Boisselier Date: Thu, 1 Sep 2016 21:53:43 +0000 (+0200) Subject: +nb_repos_status X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=59f2151a3b599af6dd0346ee8aa77783d0ae4713;p=nb.git +nb_repos_status --- diff --git a/etc/profile.d/nb.sh b/etc/profile.d/nb.sh index 3067eeb6..3dbedd27 100644 --- a/etc/profile.d/nb.sh +++ b/etc/profile.d/nb.sh @@ -1,10 +1,26 @@ +nb_repos_status() { + shell_help "List repos git status" "$@" && return + local status + for i in $(nb-repo-dirs); do + cd "$i" || continue + + status=$(git status -s "$i"|sed 's/^/ /') + [ -z "$status" ] || status=$'\n'"$status" + + printf ">%s%s\n" "$i" "$status" + done +} + nb_auth() { curl -ku nico https://nico.nbdom.net/private/auth/ } nb_mails() { printf '| 1-$ cat\nx\n' | mail | perl -MDate::Manip -MEncode -ne ' -BEGIN { $SIG{__WARN__} = sub{ } } +BEGIN { + $SIG{__WARN__} = sub{ }; + "'"$LANG $LC_ALL $LC_CTYPE"'" =~ /yes/ and binmode STDOUT, ":utf8"; +} $. == 2 and print; /^From / .. /^$/ or next; chomp; @@ -13,15 +29,15 @@ if ($_ eq "") { $h{Date} = &UnixDate($h{Date},"%Y-%m-%d %H:%M"); $h{Subject} = decode("MIME-Header",$h{Subject}); push(@m,[ - $h{From}, $h{Date}, + $h{From}, $h{Subject}, ]); %h = (); next; } /^(Date|Subject|From): (.*)$/ and $h{$1} = $2; -END { print map {sprintf "%20.20s | %16.16s | %s\n",@$_;} sort {$b->[1] cmp $a->[1]} @m } +END { print map {sprintf "%s | %s | %s\n",@$_;} sort {$b->[1] cmp $a->[1]} @m } ' #/var/spool/mail/$USER #printf 'f *\nx\n' | mail | perl -e '@_=<>; shift @_; print shift @_; print reverse @_'