Merge branch 'print-schema'

This commit is contained in:
Yanick Champoux 2022-07-13 13:18:17 -04:00
commit b63f061617
3 changed files with 33 additions and 1 deletions

View File

@ -8,10 +8,11 @@ use YAML;
option source => (
is => 'ro',
doc => 'changelog yaml file',
default => 'CHANGELOG.yml',
);
option changelog => (
has changelog => (
lazy => 1,
is => 'ro',
default => sub($self) {
@ -57,4 +58,6 @@ sub run($self) {
print $self->as_markdown;
}
subcommand 'schema' => 'App::Changelord::Command::Schema';
'end of App::Changeman';

View File

@ -0,0 +1,29 @@
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) {
my $schema = path(__FILE__)->sibling('changelog-schema.yml')->slurp;
$schema = JSON->new->pretty->encode(YAML::Load($schema));
print $schema;
}
'end of App::Changelog::Command::Schema';