App-Changelord/lib/App/Changelord/Command/Schema.pm

27 lines
497 B
Perl
Raw Normal View History

2022-07-13 17:18:13 +00:00
package App::Changelord::Command::Schema;
# SYNOPSIS: print out the changelog schema
use 5.36.0;
use Moo;
use CLI::Osprey;
use Path::Tiny;
use JSON;
use YAML;
option json => (
is => 'ro',
default => 0,
doc => 'output schema as json',
);
sub run($self) {
2022-07-19 20:18:58 +00:00
my $schema = YAML::Load(path(__FILE__)->sibling('changelog-schema.yml')->slurp);
2022-07-13 17:18:13 +00:00
2022-07-19 20:18:58 +00:00
print $self->json ? JSON->new->pretty->encode(YAML::Load($schema)) : YAML::Dump($schema);
2022-07-13 17:18:13 +00:00
}
'end of App::Changelog::Command::Schema';