#!/usr/bin/perl -w

use strict;
use warnings;

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

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

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

die "--db <dbname> is required\n" unless $dbname;
my $distromap=DistroMap->new();

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

my $name=$ARGV[0];
my $map=$distromap->db_unimap_extra_origin2dest($dbname,$name);
print defined($map) ? $map : '';
print "\n";
exit $exit_code_not_found if $exit_code_not_found and not defined($map); 


=head1	NAME

distromap-db-query-extra-unimap - 

=head1	SYNOPSIS

B<distromap-db-query-extra-unimap>
[<other options, see --help>]
<rpmname>

=head1	DESCRIPTION

B<distromap-db-query-extra-unimap> 

=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
