#!perl

our $DATE = '2021-07-29'; # DATE
our $VERSION = '0.479'; # VERSION

use Data::Dump::Color;

@ARGV == 1 or die "Usage: $0 <sah-schema-in-perl-code>\n";
if ($ARGV[0] =~ /\A\w+(::\w+)*\*?\z/) {
    $sch = $ARGV[0];
} else {
    eval "\$sch = $ARGV[0]";
    die if $@;
}

require Data::Sah::Normalize;
my $nsch = Data::Sah::Normalize::normalize_schema($sch);
dd $nsch;

# ABSTRACT: Normalize Sah schema
# PODNAME: normalize-sah-schema

__END__

=pod

=encoding UTF-8

=head1 NAME

normalize-sah-schema - Normalize Sah schema

=head1 VERSION

This document describes version 0.479 of normalize-sah-schema (from Perl distribution App-SahUtils), released on 2021-07-29.

=head1 SYNOPSIS

 % normalize-sah-schema '"int"'
 ["int", {}, {}]

 % normalize-sah-schema '["int", min=>1]'
 ["int", { min => 1 }, {}]

=head1 DESCRIPTION

This script can be used to quickly produce/see the normalized form of a L<Sah>
schema. Both input and output are in the form of Perl code.

=head1 HOMEPAGE

Please visit the project's homepage at L<https://metacpan.org/release/App-SahUtils>.

=head1 SOURCE

Source repository is at L<https://github.com/perlancar/perl-App-SahUtils>.

=head1 BUGS

Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=App-SahUtils>

When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.

=head1 SEE ALSO

L<validate-with-sah> can also show normalized schema using the C<--show-schema>
option.

=head1 AUTHOR

perlancar <perlancar@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2021, 2020, 2019, 2018, 2017, 2016, 2015 by perlancar@cpan.org.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut