Commit | Line | Data |
c97878e5 |
1 | #!/usr/bin/env perl |
2 | use strict; |
3 | use warnings; |
4 | |
5 | use Software::LicenseUtils; |
7fec23ed |
6 | use Getopt::Long qw(:config gnu_getopt); |
7 | |
8 | GetOptions( |
9 | "o|output=s" => \(my $output = '-'), |
10 | ) or die("Error in command line arguments!\n"); |
c97878e5 |
11 | |
12 | my ($authors, @licenses) = @ARGV; |
13 | |
7fec23ed |
14 | my $out; |
15 | if ($output eq '-') { |
16 | $out = \*STDOUT; |
17 | } |
18 | else { |
19 | open $out, '>', $output |
20 | or die "Unable to write to $output: $!\n"; |
21 | } |
22 | |
c97878e5 |
23 | my %uniq; |
7fec23ed |
24 | print { $out } |
c97878e5 |
25 | join "\n\n", |
26 | map { $_->new({holder => $authors})->license } |
27 | grep { !$uniq{$_}++ } |
28 | map { Software::LicenseUtils->guess_license_from_meta_key($_, 2) } |
29 | @licenses; |