#!/usr/bin/perl
use strict;
use warnings;
use YAML::Tiny;
use File::Spec;
use App::Monport;
use Getopt::Long;
use Pod::Usage;

# Command line options
GetOptions( "h|?|help" => \( my $help ), )
  or pod2usage(1);

# Help
pod2usage( -exitval => 0, -verbose => 2, -noperldoc => 1 ) if $help;

my $conf_file = File::Spec->catfile( $ENV{HOME}, '.monport.yml' );
my @hosts = @ARGV;

if (@hosts) {
    create_config( $conf_file, @hosts );
} else {
    compare_config($conf_file);
}

__END__

=head1 NAME

monport - keep an eye on network ports

=head1 SYNOPSIS

monport [options] [hosts]

  options:
    -h, -?, --help  brief help message

=head1 DESCRIPTION

Compare the open ports against an expected state defined in a configuration
file. To create the configuration file (F<$HOME/.monport.yml>) run:

    $ monport host1 host2

To check the state of the ports:

    $ monport

=cut
