summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
a461a9a)
Support debugging overrides such as keyboard/altgr/weur.eng.inc.pl ?map.
#!/usr/bin/env perl
use 5.012;
use warnings;
#!/usr/bin/env perl
use 5.012;
use warnings;
+use JSON;
+
+our $VERSION = '1.00';
+
+our %get;
+while (@ARGV) {
+ $ARGV[0] =~ s/^--// or last; # --flag
+ my ($name, $val) = split /=/, shift, 2 or last; # set until empty
+ $get{$name} = $val // 1;
+}
+my $file = shift or die "Usage: $0 [--options] <input>\n";
my $jsonify = JSON->new->utf8->canonical;
my $jsonify = JSON->new->utf8->canonical;
-$jsonify->pretty if $opt{pretty};
+$jsonify->pretty if $get{pretty};
-my $data = do "./$ARGV[0]" or die $@;
+my $data = do "./$file" or die $@;
print $jsonify->encode($data)
=~ s{\[ \K\n ([^][]+) (?=\])}{$1 =~ s/(?:\A|\n) \s*//gr}reg;
print $jsonify->encode($data)
=~ s{\[ \K\n ([^][]+) (?=\])}{$1 =~ s/(?:\A|\n) \s*//gr}reg;