Compare commits
6 Commits
Author | SHA1 | Date |
---|---|---|
Zane C. B-H | f0326366e8 | |
Zane C. B-H | d9be57bbc7 | |
Zane C. B-H | 0b38f48bdb | |
Zane C. B-H | ac929cff82 | |
Zane C. B-H | b6242ac20e | |
Zane C. B-H | b7938c3931 |
|
@ -1,5 +1,14 @@
|
|||
Revision history for Git-PunchCard
|
||||
|
||||
0.1.0 2019-07-16/01:15
|
||||
- Display max.
|
||||
- Add avagerage/min.
|
||||
|
||||
0.0.1 2019-07-15/06:20
|
||||
- Set LC_ALL=C when calling git.
|
||||
- Properly set hourly max for the day.
|
||||
- Add hourly max at the bottom of the output.
|
||||
|
||||
0.0.0 2019-07-15/04:45
|
||||
- Initial release.
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ If no directory is specified, the current one is used.
|
|||
}
|
||||
|
||||
sub version{
|
||||
print "punchcard-git v. 0.0.0\n";
|
||||
print "punchcard-git v. 0.1.0\n";
|
||||
}
|
||||
|
||||
my @colors=(
|
||||
|
@ -129,7 +129,10 @@ my $table=Text::Table->new(
|
|||
'21',
|
||||
'22',
|
||||
'23',
|
||||
'Total'
|
||||
'Total',
|
||||
'Max',
|
||||
'Avg',
|
||||
'Min'
|
||||
);
|
||||
|
||||
my $card=$gpc->get_card;
|
||||
|
@ -142,18 +145,31 @@ foreach my $day ( @days ){
|
|||
|
||||
foreach my $hour ( @hours ){
|
||||
my $color_to_use=13*($card->{$day}{$hour}/$card->{max});
|
||||
if ( $color_to_use > 13 ){ $color_to_use=13; }
|
||||
push( @line, color($colors[$color_to_use]).$card->{$day}{$hour}.color('WHITE') );
|
||||
}
|
||||
|
||||
my $min_color=13*($card->{$day}{min}/$card->{max});
|
||||
my $average_color=13*($card->{$day}{average}/$card->{max});
|
||||
my $max_color=13*($card->{$day}{max}/$card->{max});
|
||||
|
||||
push( @line, $card->{$day}{total}.color('WHITE') );
|
||||
push( @line, color($colors[$max_color]).$card->{$day}{max}.color('WHITE') );
|
||||
push( @line, color($colors[$average_color]).sprintf('%.1f',$card->{$day}{average}).color('WHITE') );
|
||||
push( @line, color($colors[$min_color]).$card->{$day}{min}.color('WHITE') );
|
||||
|
||||
push( @data, \@line );
|
||||
}
|
||||
|
||||
$table->load( @data );
|
||||
|
||||
print $table."\nTotal: ".$card->{total}."\n";
|
||||
my $min_color=13*($card->{min}/$card->{max});
|
||||
my $average_color=13*($card->{average}/$card->{max});
|
||||
|
||||
print $table.
|
||||
"\nTotal: ".$card->{total}.
|
||||
"\nMax=".color($colors[13]).$card->{max}.color('WHITE').
|
||||
"\nAverage=".color($colors[$average_color]).sprintf("%.1f",$card->{average}).color('WHITE').
|
||||
"\nMin=".color($colors[$min_color]).$card->{min}.color('WHITE')."\n";
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
|
@ -12,11 +12,11 @@ Git::PunchCard - Gathers info for making punchcard style graphs for git.
|
|||
|
||||
=head1 VERSION
|
||||
|
||||
Version 0.0.0
|
||||
Version 0.1.0
|
||||
|
||||
=cut
|
||||
|
||||
our $VERSION = '0.0.0';
|
||||
our $VERSION = '0.1.0';
|
||||
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
@ -98,9 +98,13 @@ sub new {
|
|||
card=>{
|
||||
total=>0,
|
||||
max=>0,
|
||||
average=>0,
|
||||
min=>9999999999999999999999999999999999,
|
||||
Sun=>{
|
||||
total=>0,
|
||||
max=>0,
|
||||
average=>0,
|
||||
min=>9999999999999999999999999999999999,
|
||||
'00'=>0,
|
||||
'01'=>0,
|
||||
'02'=>0,
|
||||
|
@ -129,6 +133,8 @@ sub new {
|
|||
Mon=>{
|
||||
total=>0,
|
||||
max=>0,
|
||||
average=>0,
|
||||
min=>9999999999999999999999999999999999,
|
||||
'00'=>0,
|
||||
'01'=>0,
|
||||
'02'=>0,
|
||||
|
@ -157,6 +163,8 @@ sub new {
|
|||
Tue=>{
|
||||
total=>0,
|
||||
max=>0,
|
||||
average=>0,
|
||||
min=>9999999999999999999999999999999999,
|
||||
'00'=>0,
|
||||
'01'=>0,
|
||||
'02'=>0,
|
||||
|
@ -185,6 +193,8 @@ sub new {
|
|||
Wed=>{
|
||||
total=>0,
|
||||
max=>0,
|
||||
average=>0,
|
||||
min=>9999999999999999999999999999999999,
|
||||
'00'=>0,
|
||||
'01'=>0,
|
||||
'02'=>0,
|
||||
|
@ -213,6 +223,8 @@ sub new {
|
|||
Thu=>{
|
||||
total=>0,
|
||||
max=>0,
|
||||
average=>0,
|
||||
min=>9999999999999999999999999999999999,
|
||||
'00'=>0,
|
||||
'01'=>0,
|
||||
'02'=>0,
|
||||
|
@ -241,6 +253,8 @@ sub new {
|
|||
Fri=>{
|
||||
total=>0,
|
||||
max=>0,
|
||||
average=>0,
|
||||
min=>9999999999999999999999999999999999,
|
||||
'00'=>0,
|
||||
'01'=>0,
|
||||
'02'=>0,
|
||||
|
@ -269,6 +283,8 @@ sub new {
|
|||
Sat=>{
|
||||
total=>0,
|
||||
max=>0,
|
||||
average=>0,
|
||||
min=>9999999999999999999999999999999999,
|
||||
'00'=>0,
|
||||
'01'=>0,
|
||||
'02'=>0,
|
||||
|
@ -332,7 +348,7 @@ sub dir {
|
|||
|
||||
chdir( $dir );
|
||||
|
||||
my $output=`git log --pretty=format:"%ad" --date=local --date=format:'%a %H'`;
|
||||
my $output=`env LC_ALL=C git log --pretty=format:"%ad" --date=local --date=format:'%a %H'`;
|
||||
if ( $? != 0){
|
||||
$self->{error}=1;
|
||||
$self->{errorString}='"--pretty=format:\"%ad\" --date=local --date=format:\'%a %H\'" exited with a non-zero value';
|
||||
|
@ -358,11 +374,27 @@ sub dir {
|
|||
$self->{card}{max}=$self->{card}{$day}{$hour};
|
||||
}
|
||||
if ( $self->{card}{$day}{$hour} > $self->{card}{$day}{max}){
|
||||
$self->{card}{max}=$self->{card}{$day}{$hour};
|
||||
$self->{card}{$day}{max}=$self->{card}{$day}{$hour};
|
||||
}
|
||||
}
|
||||
|
||||
$self->{card}{$day}{average}= $self->{card}{$day}{total} / 24;
|
||||
}
|
||||
|
||||
$self->{card}{average}= $self->{card}{total} / 168 ;
|
||||
|
||||
foreach my $day ( 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ){
|
||||
for my $hour ( '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23' ){
|
||||
if ( $self->{card}{$day}{$hour} < $self->{card}{$day}{min} ){
|
||||
$self->{card}{$day}{min}=$self->{card}{$day}{$hour};
|
||||
}
|
||||
if ( $self->{card}{$day}{$hour} < $self->{card}{min} ){
|
||||
$self->{card}{min}=$self->{card}{$day}{$hour};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -376,7 +408,8 @@ The first level keys are the three letter
|
|||
day names the the second level keys are the
|
||||
two digit hour.
|
||||
|
||||
There are two special keys 'total' and 'max'.
|
||||
There are two special keys 'total', 'max', min, and
|
||||
avagerage.
|
||||
|
||||
'total' represents the total level of commits. So
|
||||
at the primary level it is all the commits made to that
|
||||
|
@ -387,6 +420,9 @@ made to that repo on that day of the week.
|
|||
level it is any hour on any day of the week while at the secondary
|
||||
level it is the max made during any given hour that day.
|
||||
|
||||
'min' and 'average' is similar as max, but representing the min
|
||||
and average instead.
|
||||
|
||||
For examples of making use of this, see the SYNOPSIS or check
|
||||
out the script punchard-git.
|
||||
|
||||
|
|
23
README.md
23
README.md
|
@ -0,0 +1,23 @@
|
|||
# ABOUT
|
||||
|
||||
![screenshot](screenshot.png)
|
||||
|
||||
# INSTALLING
|
||||
|
||||
# FreeBSD
|
||||
|
||||
pkg install p5-App-cpanminus p5-Error-Helper p5-Term-ANSIColor p5-Text-Table
|
||||
cpanm Git::PunchCard
|
||||
|
||||
## Linux
|
||||
|
||||
### CentOS
|
||||
|
||||
yum install perl-App-cpanminus
|
||||
cpanm Git::PunchCard
|
||||
|
||||
### Debian
|
||||
|
||||
apt install perl perl-base perl-modules make cpanminus
|
||||
cpanm Git::PunchCard
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 40 KiB |
Loading…
Reference in New Issue