File Coverage

blib/lib/Chef/Knife/Cmd/Vault.pm
Criterion Covered Total %
statement 37 37 100.0
branch 4 8 50.0
condition n/a
subroutine 7 7 100.0
pod 0 6 0.0
total 48 58 82.7


line stmt bran cond sub pod time code
1             package Chef::Knife::Cmd::Vault;
2 6     6   20 use Moo;
  6         5  
  6         23  
3              
4             has knife => (is => 'ro', required => 1, handles => [qw/handle_options run/]);
5              
6             sub create {
7 1     1 0 628 my ($self, $vault, $item, $values, %options) = @_;
8 1         4 my @opts = $self->handle_options(%options);
9 1         2 my @cmd = (qw/knife vault create/, $vault, $item);
10 1 50       5 push @cmd, $values if $values;
11 1         2 push @cmd, @opts;
12 1         2 $self->run(@cmd);
13             }
14              
15             sub update {
16 1     1 0 501 my ($self, $vault, $item, $values, %options) = @_;
17 1         15 my @opts = $self->handle_options(%options);
18 1         2 my @cmd = (qw/knife vault update/, $vault, $item);
19 1 50       3 push @cmd, $values if $values;
20 1         2 push @cmd, @opts;
21 1         16 $self->run(@cmd);
22             }
23              
24             sub delete {
25 1     1 0 343 my ($self, $vault, $item, %options) = @_;
26 1         15 my @opts = $self->handle_options(%options);
27 1         3 my @cmd = (qw/knife vault delete/, $vault, $item);
28 1         2 push @cmd, @opts;
29 1         15 $self->run(@cmd);
30             }
31              
32             sub show {
33 1     1 0 330 my ($self, $vault, $item, %options) = @_;
34 1         14 my @opts = $self->handle_options(%options);
35 1         3 my @cmd = (qw/knife vault show/, $vault);
36 1 50       3 push @cmd, $item if $item;
37 1         1 push @cmd, @opts;
38 1         15 $self->run(@cmd);
39             }
40              
41             sub list {
42 1     1 0 297 my ($self, %options) = @_;
43 1         15 my @opts = $self->handle_options(%options);
44 1         2 my @cmd = (qw/knife vault list/);
45 1         2 push @cmd, @opts;
46 1         14 $self->run(@cmd);
47             }
48              
49             sub remove {
50 1     1 0 288 my ($self, $vault, $item, $values, %options) = @_;
51 1         15 my @opts = $self->handle_options(%options);
52 1         3 my @cmd = (qw/knife vault remove/, $vault, $item);
53 1 50       2 push @cmd, $values if $values;
54 1         2 push @cmd, @opts;
55 1         14 $self->run(@cmd);
56             }
57              
58             1;