#!/usr/bin/perl -w

use strict;
use warnings;

use DistroMap;
use Source::Shared::CLI;
our @ISA=qw/Source::Shared::CLI/;

my $opt_print_first=0;
my $exit_code_not_found=0;

sub cli_container_ref {['DistroMap']};
our @LONGOPT=(
    "exit-not-found=i" => \$exit_code_not_found,
    );
our @LONGOPT_POD2USAGE;
__PACKAGE__->get_and_process_cli_options();

my $distromap=DistroMap->new();

if (@ARGV!=1) {
    __PACKAGE__->usage();
    exit 2;
}

my $name=$ARGV[0];
my @map=$distromap->db_multimap_binary_origin2dest($name);
print $opt_print_first ? (scalar @map ? $map[0] : '') : join (' ',@map);
print "\n";
exit $exit_code_not_found if $exit_code_not_found and not @map; 


=head1	NAME

distromap-db-query-binary-name - 

=head1	SYNOPSIS

B<distromap-db-query-binary-name>
[<other options, see --help>]
<rpmname>

=head1	DESCRIPTION

B<distromap-db-query-binary-name> 

=head1	OPTIONS

=over

=item	B<-h, --help>

Display other options, display this help and exit.

=item	B<-exit-not-found I<code>>

Exit with code I<code> if map not found.

=back

=head1	AUTHOR

Written by Igor Vlasenko <viy@altlinux.org>.

=head1	COPYING

Copyright (c) 2009-2017 Igor Vlasenko, ALT Linux Team.

This is free software; you can redistribute it and/or modify it under the terms
of the GNU General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.

=cut
