| 1 | package Zed::Plugin::Exe::Get; | ||
| 2 | |||
| 3 | use Zed::Plugin; | ||
| 4 | use Zed::Output; | ||
| 5 | use Zed::Config::Env; | ||
| 6 | use Zed::Config::Space; | ||
| 7 | |||
| 8 | use strict; | ||
| 9 | |||
| 10 | =head1 SYNOPSIS | ||
| 11 | |||
| 12 | get remotefile localfile | ||
| 13 | ex: | ||
| 14 | get /tmp/foo /tmp/bar | ||
| 15 | |||
| 16 | =cut | ||
| 17 | |||
| 18 | our %OPT = ( glob => 1, recursive => 1, stdout_discard => 1,stderr_discard => 1 ); | ||
| 19 | |||
| 20 | invoke "get" => sub { | ||
| 21 | my ( @files, @host) = @_; | ||
| 22 | |||
| 23 | return unless @files and @host = targets(); | ||
| 24 | |||
| 25 | if(@files == 1) | ||
| 26 | { | ||
| 27 | push @files, $files[-1]. "@%HOST%" | ||
| 28 | |||
| 29 | }elsif( -d $files[-1]){ | ||
| 30 | |||
| 31 | $files[-1] .= "/%HOST%"; | ||
| 32 | }else{ | ||
| 33 | |||
| 34 | $files[-1] .= "@%HOST%"; | ||
| 35 | } | ||
| 36 | |||
| 37 | Zed::SSHPool::run(\@host => 'get', { %OPT }, @files); | ||
| 38 | }; | ||
| 39 | 1; |