Last change
on this file since 41 was
41,
checked in by nanardon, 15 years ago
|
- start synchronisation work
|
-
Property svn:keywords set to
Id Rev
|
File size:
1.1 KB
|
Rev | Line | |
---|
[41] | 1 | #!/usr/bin/perl |
---|
| 2 | |
---|
| 3 | use strict; |
---|
| 4 | use warnings; |
---|
| 5 | use LATMOS::Accounts; |
---|
| 6 | use LATMOS::Accounts::Synchro; |
---|
| 7 | use Getopt::Long; |
---|
| 8 | use Pod::Usage; |
---|
| 9 | |
---|
| 10 | =head1 NAME |
---|
| 11 | |
---|
| 12 | la-sync - Tools to synchronize base |
---|
| 13 | |
---|
| 14 | =head1 SYNOPSIS |
---|
| 15 | |
---|
| 16 | Show configured bases: |
---|
| 17 | |
---|
| 18 | la-sync [options] |
---|
| 19 | |
---|
| 20 | =cut |
---|
| 21 | |
---|
| 22 | GetOptions( |
---|
| 23 | 'c|config=s' => \my $config, |
---|
| 24 | 'help' => sub { pod2usage(0) }, |
---|
| 25 | 'from=s' => \my $from, |
---|
| 26 | 'to=s' => \my @to, |
---|
| 27 | ) or pod2usage(); |
---|
| 28 | |
---|
| 29 | =head1 OPTIONS |
---|
| 30 | |
---|
| 31 | =item -c|--config configfile |
---|
| 32 | |
---|
| 33 | Use this configuration file instead default |
---|
| 34 | |
---|
| 35 | =item --from basename |
---|
| 36 | |
---|
| 37 | Specify souce base to use |
---|
| 38 | |
---|
| 39 | =item --to basename |
---|
| 40 | |
---|
| 41 | Specify destination base to use, this option can be used |
---|
| 42 | severals times |
---|
| 43 | |
---|
| 44 | =cut |
---|
| 45 | |
---|
| 46 | my $LA = LATMOS::Accounts->new($config); |
---|
| 47 | |
---|
| 48 | # TODO LATMOS::Accounts::Synchro creation can be done by LATMOS::Account |
---|
| 49 | my $labfrom = $from ? $LA->base($from) : $LA->default_base; |
---|
| 50 | |
---|
| 51 | my @labto = map { $LA->base($_) } |
---|
| 52 | @to |
---|
| 53 | ? @to |
---|
| 54 | : ($LA->config_sync_base($from |
---|
| 55 | ? $from |
---|
| 56 | : $LA->default_base_name |
---|
| 57 | ) |
---|
| 58 | ); |
---|
| 59 | |
---|
| 60 | my $sync = LATMOS::Accounts::Synchro->new($labfrom, [ @labto ]); |
---|
| 61 | $sync->load_dest and return; |
---|
| 62 | $sync->process or warn "Sync has failed\n"; |
---|
Note: See
TracBrowser
for help on using the repository browser.