diff --git a/lib/App/Changelord.pm b/lib/App/Changelord.pm index 8d16e63..3c8361d 100644 --- a/lib/App/Changelord.pm +++ b/lib/App/Changelord.pm @@ -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'; diff --git a/lib/App/Changelord/Command/Schema.pm b/lib/App/Changelord/Command/Schema.pm new file mode 100644 index 0000000..b573be2 --- /dev/null +++ b/lib/App/Changelord/Command/Schema.pm @@ -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'; diff --git a/changelog-schema.yaml b/lib/App/Changelord/Command/changelog-schema.yml similarity index 100% rename from changelog-schema.yaml rename to lib/App/Changelord/Command/changelog-schema.yml