| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# ABSTRACT: get document details |
|
2
|
2
|
|
|
2
|
|
1321
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
62
|
|
|
3
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
88
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Smartcat::App::Command::document; |
|
6
|
2
|
|
|
2
|
|
11
|
use Smartcat::App -command; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub opt_spec { |
|
9
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
10
|
|
|
|
|
|
|
|
|
11
|
0
|
|
|
|
|
|
my @opts = $self->SUPER::opt_spec(); |
|
12
|
|
|
|
|
|
|
|
|
13
|
0
|
|
|
|
|
|
push @opts, |
|
14
|
|
|
|
|
|
|
[ 'document-ids|document-id:s@' => 'Document Ids' ], |
|
15
|
|
|
|
|
|
|
[ 'delete' => 'Delete documents' ]; |
|
16
|
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
return @opts; |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub validate_args { |
|
21
|
0
|
|
|
0
|
1
|
|
my ( $self, $opt, $args ) = @_; |
|
22
|
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
$self->SUPER::validate_args( $opt, $args ); |
|
24
|
|
|
|
|
|
|
$self->usage_error("'document_id' is required") |
|
25
|
0
|
0
|
|
|
|
|
unless defined $opt->{document_ids}; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub get_and_print_document_details { |
|
29
|
0
|
|
|
0
|
0
|
|
my ( $self, $document_id ) = @_; |
|
30
|
0
|
|
|
|
|
|
my $document = $self->app->document_api->get_document($document_id); |
|
31
|
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
printf( |
|
33
|
|
|
|
|
|
|
"Document Details\n Name: '%s'\n Id: '%s'\n Status: '%s'\n DisassemblingStatus: '%s'\n", |
|
34
|
|
|
|
|
|
|
$document->name, $document->id, $document->status, |
|
35
|
|
|
|
|
|
|
$document->document_disassembling_status ); |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub execute { |
|
39
|
0
|
|
|
0
|
1
|
|
my ( $self, $opt, $args ) = @_; |
|
40
|
0
|
0
|
|
|
|
|
if ( defined $opt->{delete} ) { |
|
41
|
0
|
|
|
|
|
|
$self->app->document_api->delete_documents( $opt->{document_ids} ); |
|
42
|
0
|
|
|
|
|
|
exit 0; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
0
|
|
|
|
|
|
$self->get_and_print_document_details($_) for @{ $opt->{document_ids} }; |
|
|
0
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |