diff --git a/lib/App/Changelord/Command/Print.pm b/lib/App/Changelord/Command/Print.pm index ba6b240..54b586e 100644 --- a/lib/App/Changelord/Command/Print.pm +++ b/lib/App/Changelord/Command/Print.pm @@ -9,6 +9,9 @@ use CLI::Osprey Render the full changelog. The default is to render the changelog in markdow, but the option C<--json> can be used to have a JSON version instead. + +To generate the changelog without the NEXT release, uses the +C<--no-next> option. END with 'App::Changelord::Role::Changelog'; @@ -21,9 +24,16 @@ option json => ( doc => 'output schema as json', ); +option next => ( + is => 'ro', + default => 1, + negatable => 1, + doc => 'include the NEXT release. Defaults to true.', +); + sub run($self) { no warnings 'utf8'; - print $self->as_markdown; + print $self->as_markdown( $self->next ); } 'end of App::Changelog::Command::Print'; diff --git a/lib/App/Changelord/Role/Render.pm b/lib/App/Changelord/Role/Render.pm index 75d22ee..da1a68b 100644 --- a/lib/App/Changelord/Role/Render.pm +++ b/lib/App/Changelord/Role/Render.pm @@ -40,14 +40,18 @@ sub render_refs ( $self, %links ) { return $output . "\n"; } -sub as_markdown ($self) { +sub as_markdown ($self, $with_next = 1) { my $changelog = $self->changelog; my $output = $self->render_header; my $n = 0; $output .= join "\n", - map { $self->render_release( $_, $n++ ) } $changelog->{releases}->@*; + map { $self->render_release( $_, $n++ ) } + grep { + $with_next ? 1 : ( $_->{version} && $_->version ne 'NEXT' ) + } + $changelog->{releases}->@*; return $output; }