Created
September 9, 2020 16:44
-
-
Save bessarabov/9e82be275c61027592fbf64716330f63 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings FATAL => 'all'; | |
use feature 'say'; | |
use utf8; | |
use open qw(:std :utf8); | |
sub main { | |
my $result = `git log --name-only`; | |
my %files; | |
foreach my $line (split /\n/, $result) { | |
next if $line =~ /^commit /; | |
next if $line =~ /^Author: /; | |
next if $line =~ /^Date: /; | |
next if $line =~ /^Merge: /; | |
next if $line =~ /^\s*\z/; | |
next if $line =~ /^ /; | |
if ($line =~ /\.markdown\z/ && -e $line) { | |
$files{$line}++; | |
} | |
} | |
foreach my $file_name (sort { $files{$b} <=> $files{$a} } keys %files) { | |
$file_name =~ m'source/_?(.*).markdown'; | |
my $url = 'https://www.home-assistant.io/' . $1 ; | |
say ' 1. ' . $files{$file_name} . ' ' . $url; | |
} | |
} | |
main(); | |
__END__ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment