#!/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, }), );