App-Glacier

 view release on metacpan or  search on metacpan

lib/App/Glacier/Command/Sync.pm  view on Meta::CPAN

package App::Glacier::Command::Sync;

use strict;
use warnings;
use App::Glacier::Core;
use parent qw(App::Glacier::Command);
use App::Glacier::DateTime;
use App::Glacier::Timestamp;
use App::Glacier::Job::InventoryRetrieval;
use JSON;

=head1 NAME

glacier sync - synchronize vault inventory cache

=head1 SYNOPSIS

B<glacier sync>
[B<-df>]
[B<--delete>]    
[B<--force>]
I<VAULT>

=head1 DESCRIPTION

Retrieves inventory for I<VAULT> and incorporates it into the local
directory.  Use this command if the local directory went out of sync
or was otherwise clobbered.

=head1 OPTIONS

=over 4

=item B<-d>, B<--delete>

Deletes from the directory items that have no corresponding archive IDs in
the inventory.
    
=item B<-f>, B<--force>

Initiate new inventory retrieval job, even if one is already in progress.

=back

=head1 SEE ALSO

B<glacier>(1).    
    
=cut

sub new {
    my ($class, $argref, %opts) = @_;
    $class->SUPER::new(
	$argref,
	optmap => {
	    'force|f' => 'force',
	    'delete|d' => 'delete'
	},
	%opts);
}

sub run {
    my $self = shift;
    $self->abend(EX_USAGE, "one argument expected")
	unless $self->command_line == 1;
    unless ($self->sync(($self->command_line)[0], %{$self->{_options}})) {
	exit(EX_TEMPFAIL);



( run in 0.557 second using v1.01-cache-2.11-cpan-5a3173703d6 )