June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -1,13 +1,11 @@
#!/usr/bin/env perl6
use File::Temp;
my $tmpfile = tmpfile;
my ($tmpfile, $out) = tempfile;
sub MAIN ($file, *%changes) {
%changes.=map({; .key.uc => .value });
my %seen;
my $out = open $tmpfile, :w;
for $file.IO.lines {
when /:s ^ ('#' .* | '') $/ {
say $out: ~$0;
@ -27,16 +25,11 @@ sub MAIN ($file, *%changes) {
say $out: format-line .key, |(.value ~~ Bool ?? (Nil, .value) !! (.value, True))
for %changes;
move $tmpfile, $file;
$out.close;
copy $tmpfile, $file;
}
END { unlink $tmpfile if $tmpfile.IO.e }
sub format-line ($key, $value, $enabled) {
("; " if !$enabled) ~ $key.uc ~ (" $value" if defined $value);
}
sub tmpfile {
$*SPEC.catfile: $*SPEC.tmpdir, ("a".."z").roll(20).join
}