Skip to content

Instantly share code, notes, and snippets.

@bessarabov
Created September 9, 2020 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bessarabov/9e82be275c61027592fbf64716330f63 to your computer and use it in GitHub Desktop.
Save bessarabov/9e82be275c61027592fbf64716330f63 to your computer and use it in GitHub Desktop.
#!/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