#!/usr/bin/env perl

use warnings;
use strict;
use Dist::Joseki::Find;
use Getopt::Attribute;


our $VERSION = '0.12';


our $prefix    : Getopt(prefix|p=s);
our $suffix    : Getopt(suffix|s=s);
our $join      : Getopt(join|j=s);

# print one entry per line? disregard --join in that case
our $line_mode : Getopt(line|l);

# only print projroots, then exit -- no distfind
our $print_roots : Getopt(printroots);

# only print path to one or more given distributions
our @print_path : Getopt(printpath=s);

my $find = Dist::Joseki::Find->new;

if ($print_roots) {
    print join ' ' => $find->projroot;
    exit;
}

my @distro = $find->find_dists(\@print_path);

$join = ' ' unless defined $join;
$prefix = '' unless defined $prefix;
$suffix = '' unless defined $suffix;

@distro = map { "$prefix$_$suffix" } @distro;
if ($line_mode) {
    print "$_\n" for @distro;
} else {
    print join $join => @distro;
}


__END__

=head1 NAME

Dist::Joseki - tools for the prolific module author

=head1 SYNOPSIS

None yet (see below).

=head1 DESCRIPTION

None yet. This is an early release; fully functional, but undocumented. The
next release will have more documentation.

=cut

