2022-07-16 17:33:03 +00:00
|
|
|
package App::Changelord::Command::Version;
|
|
|
|
# SYNOPSIS: output the latest / next version
|
|
|
|
|
|
|
|
use 5.36.0;
|
|
|
|
|
|
|
|
use Moo;
|
|
|
|
use CLI::Osprey
|
|
|
|
desc => 'output the latest/next version';
|
|
|
|
|
|
|
|
use Path::Tiny;
|
|
|
|
use JSON;
|
|
|
|
use YAML::XS;
|
|
|
|
use List::AllUtils qw/ first min /;
|
|
|
|
use Version::Dotted::Semantic;
|
|
|
|
|
2022-07-25 16:08:20 +00:00
|
|
|
with 'App::Changelord::Role::Changelog';
|
2022-07-16 17:33:03 +00:00
|
|
|
with 'App::Changelord::Role::ChangeTypes';
|
2022-07-25 16:08:20 +00:00
|
|
|
with 'App::Changelord::Role::Versions';
|
2022-07-16 17:33:03 +00:00
|
|
|
|
|
|
|
sub run($self) {
|
|
|
|
my $param = shift @ARGV;
|
|
|
|
|
|
|
|
die "invalid parameter '$param', needs to be nothing, 'next' or 'latest'\n"
|
|
|
|
if $param and not grep { $param eq $_ } qw/ next latest /;
|
|
|
|
|
|
|
|
if(!$param) {
|
|
|
|
say "latest version: ", $self->latest_version;
|
|
|
|
say "next version: ", $self->next_version;
|
|
|
|
}
|
|
|
|
elsif( $param eq 'next' ) {
|
|
|
|
say $self->next_version;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
say $self->latest_version;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
'end of App::Changelog::Command::Version';
|