add the schema subcommand

releases
Yanick Champoux 2022-07-13 13:18:13 -04:00
parent 1d70fc0b70
commit 9668393bcc
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';