X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FApp%2FPromulger%2FCommand%2Fnewlist.pm;h=d4a386eb9bc59eabe65398929c317b56cfd0627c;hb=21baaef0e40fb1f234a9cf27432d67e73a4e9b92;hp=3ca908c51e33ea9446ea87486889f0420a21722a;hpb=35269bf5b66fdcf9e07a81dffd4d44aeea70c5e5;p=p5sagit%2FPromulger.git diff --git a/lib/App/Promulger/Command/newlist.pm b/lib/App/Promulger/Command/newlist.pm index 3ca908c..d4a386e 100644 --- a/lib/App/Promulger/Command/newlist.pm +++ b/lib/App/Promulger/Command/newlist.pm @@ -4,44 +4,18 @@ use warnings; use App::Promulger -command; use Promulger::List; -use Config::General; sub abstract { return "creates a new list"; } -sub opt_spec { - return ( - [ "config|c=s", "configuration file", { required => 1 } ], - ); -} - -sub validate_args { - my ($self, $opt, $args) = @_; - my $cf = $opt->{config}; - - unless(-e $cf) { - die "Config file $cf doesn't exist\n"; - } - unless(-f $cf) { - die "Config file $cf not a file\n"; - } - unless(-r $cf) { - die "Config file $cf not readable\n"; - } - - $self->{config} = { Config::General->new($cf)->getall }; - $self->{config}{config_file} = $cf; -} - - sub run { my ($self, $opt, $args) = @_; @$args == 1 or die "pmg newlist needs a list name\n"; my $list = Promulger::List->new( listname => $args->[0], ); - $list->setup($self->{config}); + $list->setup; } 1;