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

- added global opts

parent 9d6fa761
Branches
No related tags found
No related merge requests found
...@@ -31,7 +31,8 @@ sub description { ...@@ -31,7 +31,8 @@ sub description {
return "$description" return "$description"
} }
sub opt_spec { sub opt_spec {
return( my @global_opts= SLUB::LZA::TA::common_global_opt_spec();
my @local_opts = (
#["source|s=s" => "count based on string search in source metadata"], #["source|s=s" => "count based on string search in source metadata"],
["aip|a=s" => "count AIPs by given AIP id"], ["aip|a=s" => "count AIPs by given AIP id"],
[ 'datemode' => hidden => { [ 'datemode' => hidden => {
...@@ -60,15 +61,11 @@ sub opt_spec { ...@@ -60,15 +61,11 @@ sub opt_spec {
[ 'only-ldp', 'only if AIP is LDP funded' ], [ 'only-ldp', 'only if AIP is LDP funded' ],
[ 'no-ldp', 'only if AIP is not LDP funded' ], [ 'no-ldp', 'only if AIP is not LDP funded' ],
] } ], ] } ],
[],
[],
[ 'help|h', 'print usage message and exit', { shortcircuit => 1 } ],
[ 'version|v', 'print version information', { shortcircuit => 1 } ],
); );
return (@global_opts, [], @local_opts);
} }
sub validate_args { sub validate_args {
my ($self, $opt, $args) = @_; my ($self, $opt, $args) = @_;
SLUB::LZA::TA::validate_global(@_);
# no args allowed but options! # no args allowed but options!
$self->usage_error("No args allowed") if @$args; $self->usage_error("No args allowed") if @$args;
if (exists $opt->{creationdate}) { if (exists $opt->{creationdate}) {
......
...@@ -42,7 +42,8 @@ sub description { ...@@ -42,7 +42,8 @@ sub description {
return "$description" return "$description"
} }
sub opt_spec { sub opt_spec {
return ( my @global_opts= SLUB::LZA::TA::common_global_opt_spec();
my @local_opts = (
[ 'datemode' => hidden => { [ 'datemode' => hidden => {
one_of => [ one_of => [
[ 'daily|d' => 'report based on last day'], [ 'daily|d' => 'report based on last day'],
...@@ -68,9 +69,8 @@ sub opt_spec { ...@@ -68,9 +69,8 @@ sub opt_spec {
[ 'with-ldp|l' => 'report with LDP'], [ 'with-ldp|l' => 'report with LDP'],
[ 'workflow|w=s' => 'LZA internal workflow name (optional)'], [ 'workflow|w=s' => 'LZA internal workflow name (optional)'],
[], [],
[ 'help|h', 'print usage message and exit', { shortcircuit => 1 } ],
[ 'version|v', 'print version information', { shortcircuit => 1 } ],
); );
return (@global_opts, [], @local_opts);
} }
sub validate_args { sub validate_args {
my ($self, $opt, $args) = @_; my ($self, $opt, $args) = @_;
......
...@@ -45,7 +45,8 @@ sub description { ...@@ -45,7 +45,8 @@ sub description {
return "$description" return "$description"
} }
sub opt_spec { sub opt_spec {
return ( my @global_opts= SLUB::LZA::TA::common_global_opt_spec();
my @local_opts = (
[ 'output-format' => hidden => { [ 'output-format' => hidden => {
one_of => [ one_of => [
[ 'output-as-csv|C' => 'prints output as Comma Separated Values (CSV)' ], [ 'output-as-csv|C' => 'prints output as Comma Separated Values (CSV)' ],
...@@ -114,17 +115,13 @@ sub opt_spec { ...@@ -114,17 +115,13 @@ sub opt_spec {
[ 'with-slubarchiv-sipversion' => 'also returns AIP slubarchiv-sipversion'], [ 'with-slubarchiv-sipversion' => 'also returns AIP slubarchiv-sipversion'],
[ 'with-status' => 'also returns AIP state in AIS' ], [ 'with-status' => 'also returns AIP state in AIS' ],
[ 'with-title' => 'also returns AIP title' ], [ 'with-title' => 'also returns AIP title' ],
[],
[ 'help|h', 'print usage message and exit', { shortcircuit => 1 } ],
[ 'version|v', 'print version information', { shortcircuit => 1 } ],
); );
return (@global_opts, [], @local_opts);
} }
sub validate_args { sub validate_args {
my ($self, $opt, $args) = @_; my ($self, $opt, $args) = @_;
# no args allowed but options! # no args allowed but options!
$self->usage_error("No args allowed") if @$args; $self->usage_error("No args allowed") if @$args;
SLUB::LZA::TA::validate_global(@_);
if (exists $opt->{creationdate}) { if (exists $opt->{creationdate}) {
if ($opt->{creationdate} =~ m/^(\d{4})-(\d{2})-(\d{2})$/ ) { if ($opt->{creationdate} =~ m/^(\d{4})-(\d{2})-(\d{2})$/ ) {
my $from_epoch = Date_to_Time($1, $2, $3, 0, 0, 0); my $from_epoch = Date_to_Time($1, $2, $3, 0, 0, 0);
...@@ -214,7 +211,6 @@ sub execute { ...@@ -214,7 +211,6 @@ sub execute {
#p($aips_response); #p($aips_response);
SLUB::LZA::TA::Output::print_results($aips_response, $opt); SLUB::LZA::TA::Output::print_results($aips_response, $opt);
return 1; return 1;
} }
1; 1;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment