| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package App::GitGot::Command::move; | 
| 2 |  |  |  |  |  |  | our $AUTHORITY = 'cpan:GENEHACK'; | 
| 3 |  |  |  |  |  |  | $App::GitGot::Command::move::VERSION = '1.339'; | 
| 4 |  |  |  |  |  |  | # ABSTRACT: move repo to new location | 
| 5 | 15 |  |  | 15 |  | 8909 | use 5.014; | 
|  | 15 |  |  |  |  | 58 |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 | 15 |  |  | 15 |  | 111 | use Cwd; | 
|  | 15 |  |  |  |  | 34 |  | 
|  | 15 |  |  |  |  | 1165 |  | 
| 8 | 15 |  |  | 15 |  | 9046 | use File::Copy::Recursive qw/ dirmove /; | 
|  | 15 |  |  |  |  | 109373 |  | 
|  | 15 |  |  |  |  | 1164 |  | 
| 9 | 15 |  |  | 15 |  | 135 | use Path::Tiny; | 
|  | 15 |  |  |  |  | 33 |  | 
|  | 15 |  |  |  |  | 789 |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 | 15 |  |  | 15 |  | 100 | use App::GitGot -command; | 
|  | 15 |  |  |  |  | 34 |  | 
|  | 15 |  |  |  |  | 124 |  | 
| 12 |  |  |  |  |  |  |  | 
| 13 | 15 |  |  | 15 |  | 5969 | use Moo; | 
|  | 15 |  |  |  |  | 39 |  | 
|  | 15 |  |  |  |  | 115 |  | 
| 14 |  |  |  |  |  |  | extends 'App::GitGot::Command'; | 
| 15 | 15 |  |  | 15 |  | 5187 | use namespace::autoclean; | 
|  | 15 |  |  |  |  | 65 |  | 
|  | 15 |  |  |  |  | 140 |  | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 43 |  |  | 43 | 1 | 5415 | sub command_names { qw/ move mv / } | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | sub options { | 
| 20 | 1 |  |  | 1 | 0 | 97 | my( $class , $app ) = @_; | 
| 21 |  |  |  |  |  |  | return ( | 
| 22 | 1 |  |  |  |  | 37 | [ 'destination=s' => 'FIXME' => { required => 1 } ] , | 
| 23 |  |  |  |  |  |  | ); | 
| 24 |  |  |  |  |  |  | } | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | sub _execute { | 
| 27 | 1 |  |  | 1 |  | 7 | my( $self, $opt, $args ) = @_; | 
| 28 |  |  |  |  |  |  |  | 
| 29 | 1 |  |  |  |  | 45 | my @repos = $self->active_repos; | 
| 30 |  |  |  |  |  |  |  | 
| 31 | 1 |  |  |  |  | 119 | my $dest = $self->opt->destination; | 
| 32 |  |  |  |  |  |  |  | 
| 33 | 1 | 50 |  |  |  | 10 | path($dest)->mkpath if @repos > 1; | 
| 34 |  |  |  |  |  |  |  | 
| 35 | 1 |  |  |  |  | 10 | for my $repo ( @repos ) { | 
| 36 | 1 | 50 |  |  |  | 30 | my $target_dir = -d $dest | 
| 37 |  |  |  |  |  |  | ? path($dest)->child( path($repo->path)->basename ) | 
| 38 |  |  |  |  |  |  | : $dest; | 
| 39 |  |  |  |  |  |  |  | 
| 40 | 1 | 50 |  |  |  | 50 | dirmove( $repo->path => $target_dir ) | 
| 41 |  |  |  |  |  |  | or die "couldn't move ", $repo->name, " to '$target_dir': $!"; | 
| 42 |  |  |  |  |  |  |  | 
| 43 | 1 |  |  |  |  | 74365 | $repo->{path} = "$target_dir"; | 
| 44 | 1 |  |  |  |  | 94 | $self->write_config; | 
| 45 |  |  |  |  |  |  |  | 
| 46 | 1 |  |  |  |  | 3756 | say sprintf '%s moved to %s', $repo->name, $target_dir; | 
| 47 |  |  |  |  |  |  | } | 
| 48 |  |  |  |  |  |  | } | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | 1; | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | ## FIXME docs | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | __END__ |