#!/usr/bin/perl -w
#
# $Id$
# Copyright B. Cornec 2005-today
# Provided under the GPL v2
#
# Get the value of the parameter passed in argument 
#
use strict 'vars';
use ProjectBuilder::Base;
use ProjectBuilder::Version;
use MondoRescue::Version;
use MondoRescue::Base;
use Data::Dumper;
use Getopt::Long qw(:config auto_abbrev no_ignore_case);
use English;


=pod

=head1 NAME

mr-getparam get MondoRescue parameter

=head1 DESCRIPTION

mr-getparam get a MondoRescue parameter from configuration files

=head1 SYNOPSIS

mr-getparam [-v][-h] param

=head1 ARGUMENTS

=over 4

=item B<param>

This is the parameter whose value should be returned

=back 

=head1 OPTIONS

=over 4

=item B<-v|--verbose>

Increase verbosity

=item B<-h|--help>

Print a brief help message and exits.

=item B<--man>

Prints the manual page and exits.

=back

=head1 WEB SITES

The main Web site of the project is available at L<http://www.mondorescue.org>. Bug reports should be filled using the trac instance of the project at L<http://trac.mondorescue.org/>.

=head1 USER MAILING LIST

For community exchanges around MondoRescue please use the list L<http://sourceforge.net/mailarchive/forum.php?forum_name=mondo-devel>

=head1 AUTHORS

The MondoRescue team lead by Bruno Cornec L<mailto:bruno@mondorescue.org>.

=head1 COPYRIGHT

MondoRescue is distributed under the GPL v2.0 license or later,
described in the file C<COPYING> included with the distribution.

=cut

# Global variables
my ($mrver,$mrrev) = mr_version_init();
my $appname = "mr-getparam";
my %opts;					# CLI Options

# Initialize the syntax string

pb_syntax_init("$appname Version $mrver-$mrrev\n");

GetOptions("help|?|h" => \$opts{'h'}, 
		"man" => \$opts{'man'},
		"version" => \$opts{'version'},
		"verbose|v+" => \$opts{'v'},
) || pb_syntax(-1,0);

if (defined $opts{'h'}) {
	pb_syntax(0,1);
}
if (defined $opts{'version'}) {
	pb_syntax(0,0);
}
if (defined $opts{'man'}) {
	pb_syntax(0,2);
}
if (defined $opts{'v'}) {
	$pbdebug++;
}
pb_log_init($pbdebug, $pbLOG);
pb_temp_init($pbdebug);

mr_init();
mr_conf_get(@ARGV);
