#!/usr/bin/perl
use strict;
use warnings;
use Pod::Usage;
use Getopt::Long;
use Module::BumpVersion;
use Version::Next;

my $show;
my $p = Getopt::Long::Parser->new(
    config => [qw(posix_default no_ignorecase auto_help)],
);
$p->getoptions(
    'show' => \$show,
);
my $target = shift or pod2usage;

my $bump = Module::BumpVersion->load($target);
my $version = $bump->find_version
    or die $bump->errstr;
print "Current version is: $version\n";
if ($show) {
    exit 0;
}

{
    my $next = Version::Next::next_version($version);
    $bump->set_version($next);
    print "Bumped to $next\n";
}

__END__

=head1 SYNOPSIS

    % dist-bumpversion --show /path/to/Library.pm

