summaryrefslogtreecommitdiff
path: root/bin/sharkey-icon-pack
blob: 8c2aec5253680aec1851251760e8319cbe4258fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env perl 
use v5.40;
use Path::Tiny;
use JSON::MaybeXS;
use Getopt::Long::Descriptive;
 
my ($opt,$usage) = describe_options(
    "%c %o [ file ... ]\n",
    'category=s''icon category' ],
    'help|h''print usage message and exit', { shortcircuit => 1 } ],
    {
        getopt_conf => [qw( posix_default no_ignore_case )],
        show_defaults => 1,
    },
);
if ($opt->help) {
    print $usage->text;
    exit 0;
}
 
my @emojis;
 
for my $file (@ARGV) {
    push @emojis, {
        downloaded => builtin::true,
        fileName => $file,
        emoji => {
            name => $file =~ s/\..+$//r,
            category => $opt->category,
            localOnly => builtin::false,
            isSensitive => builtin::false,
        },
    };
}
 
path('meta.json')->spew_raw(
    JSON::MaybeXS->new(
        ascii => 1,
        pretty => 0,
        )->encode({
            metaVersion => 2,
            emojis => \@emojis,
        }),
);