#!/usr/bin/env raku

use lib "lib";
use NotoFonts-OT;

# file: /bin/nf-info-list
say qq:to/HERE/;
The following data are details about the Noto fonts
and their licenses, etc. There are four parts
and each will be printed locally unless they
already exist.

1. The sha256 sums of the 10 fonts:          'SHA256SUMS.txt'
2. The Open Font License (OFL):              'OFL.txt'
3. The OFL FAQ (Frequently Asked Questions): 'OFL.txt'
4. Details of font licenses:                 'FONT-LICENSES.rakudoc'
HERE

my %docs  = %(
    1 => {
             title => 'SHA256SUMS.txt',
             path  => '/usr/local/git-repos/my-public-modules/NotoFonts-OT/resources/text/SHA256SUMS.txt',
    },
    2 => {
             title => 'OFL.txt',
             path  => '/usr/local/git-repos/my-public-modules/NotoFonts-OT/resources/text/OFL.txt',
    },
    3 => {
             title => 'OFL-FAQ.txt',
             path  => '/usr/local/git-repos/my-public-modules/NotoFonts-OT/resources/text/OFL-FAQ.txt',
    },
    4 => {
             title => 'FONT-LICENSES.rakudoc',
             path  => '/usr/local/git-repos/my-public-modules/NotoFonts-OT/resources/text/FONT-LICENSES.rakudoc',
    },
);

for 1..4 -> $n {
   my $t1 = %docs{$n}<title>;
   my $t2 = %docs{$n}<path>;
   if $t1.IO.e {
     # say "Skipped: '$t1' already exists...";
   }
   else {
       $t2.IO.copy: $t1;
     # say "Copied '$t2' to '$t1'...";
   }
}
