#!/usr/bin/perl
use strict;
use warnings;

package App::Addex::addex;

=head1 NAME

addex - create mail helper files for address book entries

=head1 VERSION

version 0.001

  $Id: /my/cs/projects/App-Addex/trunk/bin/addex 31345 2007-04-07T20:42:45.994879Z rjbs  $

=cut

our $VERSION = '0.001';

=head1 DESCRIPTION

The F<addex> command produces configuration for various email tools based on
your address book.  For more information, consult L<App::Addex>.

=cut

use App::Addex;
use Config::Tiny;
use File::HomeDir;
use File::Spec;
use Getopt::Long::Descriptive;

my ($opt, $usage) = describe_options(
  '%c %o',
  [ 'config|c=s',     'config file name',
    { default => File::Spec->catfile(File::HomeDir->my_home, '.addex') }   ],
);

my $config = Config::Tiny->read($opt->{config})
  or die "couldn't read config file $opt->{config}\n";

die 'illegal section "classes" in config' if exists $config->{classes};

$config->{classes} = delete $config->{_};

$config->{classes}{output} = [ split /,\s*/, $config->{classes}{output} ];

my $addex = App::Addex->new($config);

$addex->run;

=head1 AUTHOR

Ricardo SIGNES, C<< <rjbs@cpan.org> >>

=head1 BUGS

Please report any bugs or feature requests through the web interface at
L<http://rt.cpan.org>.  I will be notified, and then you'll automatically be
notified of progress on your bug as I make changes.

=head1 COPYRIGHT

Copyright 2006-2007 Ricardo Signes, all rights reserved.

This program is free software; you may redistribute it and/or modify it
under the same terms as Perl itself.

=cut

