1 package App::Promulger::Command::newlist;
5 use App::Promulger -command;
12 return "creates a new list";
17 [ "config|c=s", "configuration file", { required => 1 } ],
22 my ($self, $opt, $args) = @_;
23 my $cf = $opt->{config};
26 die "Config file $cf doesn't exist\n";
29 die "Config file $cf not a file\n";
32 die "Config file $cf not readable\n";
35 $self->{config} = { Config::General->new($cf)->getall };
36 @$args == 1 or die "pmg newlist needs a list name\n";
40 my ($self, $opt, $args) = @_;
41 Promulger::Schema->connect($self->{config}{store});
42 my $list = Promulger::List->new(
43 listname => $args->[0],
45 $list->setup_aliases_at($self->{config});
46 Promulger::Schema->store($list);