Skip to content
Snippets Groups Projects
Commit 1725d1bc authored by Andreas Romeyke's avatar Andreas Romeyke
Browse files

- use global opts

- fixed missed mandatory parameter check
parent a0793744
Branches
No related tags found
No related merge requests found
......@@ -14,18 +14,16 @@ use namespace::autoclean -except => qr{^SLUB::LZA::TA::.*};
sub abstract { return "Initialize $0";}
sub description { return "Initialize $0, preparing config file using given options"}
sub opt_spec {
#my $common_global_opts= SLUB::LZA::TA::global_opt_spec();
my @global_opts= grep {
defined $_->[0]
and $_->[0] !~ m/^(elasticsearch-(host|port))|(http-only)/;
} SLUB::LZA::TA::common_global_opt_spec();
my @local_opts = (
[ "help|h" => "this usage screen" ],
[ "verbose|v" => "enable verbose output" ],
[],
[ "elasticsearch-host|e=s" => "host adress of Archivematica's ElasticSearch (mandatory)" ],
[ "elasticsearch-port|E=s" => "port of Archivematica's ElasticSearch", { default => 9200 } ],
[ "http-only" => "use HTTP instead HTTPS" ],
);
#[ "logdir|l=s" => "logdir where Archivematica stores it server log files", {required => 1}],
# return ($global_opts, $local_opts);
return (@local_opts);
return (@global_opts, [], @local_opts);
}
sub validate_args {
my ($self, $opt, $args) = @_;
......@@ -33,7 +31,7 @@ sub validate_args {
$self->usage_error("No args allowed") if @$args;
$self->usage_error("Missed mandatory parameter '--elasticsearch-host'") if (
!exists($opt->{elasticsearch_host})
and exists($opt->{help})
and !exists($opt->{help})
);
return 1;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment