package App::Changelord::Command::Schema; # SYNOPSIS: print out the changelog schema use 5.36.0; use Moo; 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 use Path::Tiny; use JSON; use YAML; option json => ( is => 'ro', default => 0, doc => 'output schema as json', ); sub run($self) { my $schema = YAML::Load(path(__FILE__)->sibling('changelog-schema.yml')->slurp); print $self->json ? JSON->new->pretty->encode(YAML::Load($schema)) : YAML::Dump($schema); } 'end of App::Changelog::Command::Schema';