add the schema subcommand
This commit is contained in:
parent
1d70fc0b70
commit
9668393bcc
@ -8,10 +8,11 @@ use YAML;
|
|||||||
|
|
||||||
option source => (
|
option source => (
|
||||||
is => 'ro',
|
is => 'ro',
|
||||||
|
doc => 'changelog yaml file',
|
||||||
default => 'CHANGELOG.yml',
|
default => 'CHANGELOG.yml',
|
||||||
);
|
);
|
||||||
|
|
||||||
option changelog => (
|
has changelog => (
|
||||||
lazy => 1,
|
lazy => 1,
|
||||||
is => 'ro',
|
is => 'ro',
|
||||||
default => sub($self) {
|
default => sub($self) {
|
||||||
@ -57,4 +58,6 @@ sub run($self) {
|
|||||||
print $self->as_markdown;
|
print $self->as_markdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
subcommand 'schema' => 'App::Changelord::Command::Schema';
|
||||||
|
|
||||||
'end of App::Changeman';
|
'end of App::Changeman';
|
||||||
|
29
lib/App/Changelord/Command/Schema.pm
Normal file
29
lib/App/Changelord/Command/Schema.pm
Normal 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';
|
Loading…
Reference in New Issue
Block a user