SD/CLI/Command/Clone.pm untested

filter: Statementstmt 0.0% 0 / 18 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 24 CC 1 SCAR 6.9
CC
1
Cov
0%
ARG_TRANSLATIONS
2.0
usage_msg
2.0
BEGIN
2.0
CRAP 2.0
1 package App::SD::CLI::Command::Clone;
2 use Any::Moose;
3 extends 'Prophet::CLI::Command::Clone';
4 with 'App::SD::CLI::NewReplicaCommand';
5  
6 sub ARG_TRANSLATIONS {
7 shift->SUPER::ARG_TRANSLATIONS(),
8 # this arg is used in the new_replica_wizard sub
9 n => 'non-interactive',
10 };
11  
12 sub usage_msg {
13 my $self = shift;
14 my $cmd = $self->cli->get_script_name;
15  
16 return <<"END_USAGE";
17 usage: ${cmd}clone --from <url> [--as <alias>] [--non-interactive] | --local
18  
19 Options:
20 -n | --non-interactive - Don't prompt to specify email address for new
21 database
22 --as - Save an alias for this source, which can later be
23 used instead of the URL.
24 --local - Probe the local network for mDNS-advertised
25 replicas and list them.
26 END_USAGE
27 }
28  
29 override run => sub {
30 my $self = shift;
31  
32 # clone dies if the target replica already exists, so no need
33 # to worry about not running the wizard if the clone doesn't run
34 $self->SUPER::run();
35  
36 Prophet::CLI->end_pager();
37  
38 # Prompt for SD setup (specifically email address for changes) after the
39 # clone, but *don't* immediately edit the database's settings, since a
40 # cloned database should have already been setup previously.
41 $self->new_replica_wizard( edit_settings => 0 );
42 };
43  
44 __PACKAGE__->meta->make_immutable;
45 no Any::Moose;
46  
47 1;
48