#! /usr/bin/env perl
# Shell access to the PERLDEPENDENCYREPORT macro.
# See bottom of file for POD documentation.
#
# Author: Crawford Currie http://c-dot.co.uk and Foswiki Contributors.
#
# Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# Copyright (C) 2013-2014 Foswiki Contributors. Foswiki Contributors
# are listed in the AUTHORS file in the root of this distribution.
# NOTE: Please extend that file, not this notice.
#
# This program 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. For
# more details read LICENSE in the root of this distribution.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# As per the GPL, removal of this notice is prohibited.

use warnings;
use strict;

use Getopt::Long;
use Pod::Usage ();

# Assume we are in the tools dir, and we can find bin and lib from there
use FindBin ();
$FindBin::Bin =~ /^(.*)$/;
my $bin = $1;

use lib "$FindBin::Bin/../bin";
require 'setlib.cfg';

require Foswiki::Macros::PERLDEPENDENCYREPORT;

# Command-line parameter handling

my $all = '';

my $result = Getopt::Long::GetOptions(
    'help' => sub {
        Pod::Usage::pod2usage( -exitstatus => 0, -verbose => 2 );
    },
    "all" => \$all,
) or Pod::Usage::pod2usage( -exitstatus => 0, -verbose => 2 );

$all = ($all) ? 'all' : 'missing';

print Foswiki::cliDependencyReport($all);

1;
__END__

=head1 tools/dependencies

Shell interface to the PERLDEPENDENCYREPORT macro.  Generates a report 
of missing dependencies.

=head1 SYNOPSIS

 tools/dependencies [options]

Use all to see all dependencies, and not just missing dependencies.

=head1 OPTIONS

=over 8

=item B<all>

If set then all dependencies will be reported, not just missing dependencies.

=item B<usage> 

Information on using this script.

=back
