App-Changelord/lib/App/Changelord.pm

40 lines
693 B
Perl
Raw Normal View History

2022-07-13 16:09:07 +00:00
package App::Changelord;
2022-07-16 17:33:03 +00:00
# version next latest
2022-07-13 16:09:07 +00:00
use 5.36.0;
use Moo;
use CLI::Osprey;
use YAML;
2022-07-13 19:00:23 +00:00
use List::AllUtils qw/ pairmap partition_by /;
2022-07-16 17:33:03 +00:00
use App::Changelord::Role::ChangeTypes;
2022-07-13 16:09:07 +00:00
option source => (
is => 'ro',
2022-07-13 19:00:23 +00:00
format => 's',
2022-07-13 17:18:13 +00:00
doc => 'changelog yaml file',
2022-07-13 16:09:07 +00:00
default => 'CHANGELOG.yml',
);
2022-07-19 17:34:13 +00:00
has changelog => ( is => 'lazy' );
sub _build_changelog($self) {
return YAML::LoadFile($self->source)
}
2022-07-13 16:09:07 +00:00
2022-07-16 17:33:03 +00:00
with 'App::Changelord::Role::ChangeTypes';
2022-07-20 13:59:23 +00:00
with 'App::Changelord::Role::Render';
2022-07-13 16:09:07 +00:00
sub run($self) {
no warnings 'utf8';
print $self->as_markdown;
}
2022-07-19 17:34:13 +00:00
subcommand $_ => 'App::Changelord::Command::' . ucfirst $_
2022-07-19 20:18:58 +00:00
for qw/ schema validate version bump init add/;
2022-07-13 17:18:13 +00:00
2022-07-19 17:34:13 +00:00
1;