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;
|
2022-07-25 15:58:17 +00:00
|
|
|
use CLI::Osprey
|
|
|
|
doc => 'print JSON schema for the changelog format',
|
|
|
|
description_pod => <<'END';
|
|
|
|
Print the JSON schema describing the data format used by changelord.
|
|
|
|
|
|
|
|
By defaults prints the schema in YAML. Can also be printed as JSON
|
|
|
|
via the C<--json> option.
|
|
|
|
END
|
2022-07-13 17:18:13 +00:00
|
|
|
|
|
|
|
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';
|