use SBOM::Raku:ver<0.0.13>:auth<zef:lizmat> <produce-source-sbom>;

my str @errors;
my sub error(IO::Path:D $io, Str() $) { @errors.push: $io.absolute }
my int $created;
my sub created(IO::Path:D $) { ++$created }
my int $updated;
my sub updated(IO::Path:D $) { ++$updated }

#| Produce source SBOMs in their associated .META directory for the
#| given META6.json files
sub MAIN(*@jsons) {
    if @jsons {
        produce-source-sbom($_, :&created, :&updated, :&error) for @jsons;

        if @errors {
            note "Files that did not produce a source SBOM:";
            note "  $_" for @errors;
        }
        if $created {
            note "Created $created source SBOM{'s' if $created > 1}";
        }
        if $updated {
            note "Updated $updated source SBOM{'s' if $updated > 1}";
        }
    }
    else {
        note "No META6.json files specified";
    }
}

# vim: expandtab shiftwidth=4
