Skip to content

Commit 422f0d1

Browse files
committed
Make Greppable more forgiving
So that windows newlines and other things work less horribly.
1 parent 8b040db commit 422f0d1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

xbin/Greppable.p6

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ sub process-grep-line($line, %commits) { # 🙈
7373

7474
take ~$repo # used for stats in PrettyLink
7575
}
76-
$text = shorten $text, 300; # do not print too long lines
76+
$text = shorten $text || , 300; # do not print too long lines
7777
$text = markdown-escape $text;
7878
$text ~~ s:g/ “\c[ESC][1;31m” (.*?) [ “\c[ESC][m” | $ ] /<b>{$0}<\/b>/; # TODO get rid of \/ ?
7979

@@ -103,7 +103,7 @@ multi method irc-to-me($msg) {
103103
my %commits = ();
104104
my $gist = | File | Code |\n|--|--|\n;
105105
my $stats = gather {
106-
$gist ~= $result<output>.split(\n).map({process-grep-line $_, %commits}).join: \n;
106+
$gist ~= $result<output>.lines.map({process-grep-line $_, %commits}).join: \n;
107107
}
108108
my $total = $stats.elems;
109109
my $modules = $stats.Set.elems;

0 commit comments

Comments
 (0)