Skip to content

Commit

Permalink
moved comment to each commands
Browse files Browse the repository at this point in the history
  • Loading branch information
dann committed Jul 11, 2008
1 parent 5fef590 commit c69054c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
2 changes: 2 additions & 0 deletions lib/Shell/Amazon/S3/Command/getfile.pm
Expand Up @@ -4,6 +4,8 @@ use Path::Class qw(file);

extends 'Shell::Amazon::S3::CommandWithBucket';

has '+desc' => ( default => 'getfile <id> <file>' );

override 'validate_tokens', sub {
my ( $self, $tokens ) = @_;
if ( !@{$tokens} == 2 ) {
Expand Down
12 changes: 2 additions & 10 deletions lib/Shell/Amazon/S3/Command/help.pm
Expand Up @@ -38,31 +38,23 @@ sub get_command_summary {
sprintf("%20s -- $desc", Shell::Amazon::S3::Utils->classsuffix(ref $command));
}

# FIXME: MOVE TO
# FIXME: MOVE TO help doc to each command
sub execute2 {
my ( $self, $args ) = @_;

my $result = '';
$result .= "\n";
$result .= "exit\n";
$result .= "get <id>\n";
$result .= "getacl ['bucket'|'item'] <id>\n";
$result .= "getfile <id> <file>\n";
$result .= "gettorrent <id>\n";
$result .= "head ['bucket'|'item'] <id>\n";
$result .= "host [hostname]\n";
$result .= "list [prefix] [max]\n";
$result .= "listatom [prefix] [max]\n";
$result .= "listrss [prefix] [max]\n";
$result .= "listbuckets\n";
$result .= "pass [password]\n";
$result .= "put <id> <data>\n";
$result .= "putfile <id> <file>\n";
$result
.= "\n";
# putfile <id> <file>
$result .= "quit\n";
$result
.= "setacl ['bucket'|'item'] <id> ['private'|'public-read'|'public-read-write'|'authenticated-read']\n";
$result .= "user [username]\n";

return $result;
Expand Down
17 changes: 10 additions & 7 deletions lib/Shell/Amazon/S3/Command/listbuckets.pm
Expand Up @@ -3,24 +3,27 @@ use Moose;

extends 'Shell::Amazon::S3::Command';

override 'validate_tokens' , sub {
my ($self, $tokens) = @_;
has '+desc' => ( default => 'listbuckets' );

override 'validate_tokens', sub {
my ( $self, $tokens ) = @_;

# TODO
if ( @{$tokens} != 0 ) {
return (0, "error: This command doesn't need arguments");
return ( 0, "error: This command doesn't need arguments" );
}
return (1, "");
return ( 1, "" );
};

override 'parse_tokens', sub {
my ($self, $tokens) = @_;
my ( $self, $tokens ) = @_;
return $tokens;
};

sub execute {
my ($self, $args) = @_;
my ( $self, $args ) = @_;
my $response = $self->api->buckets;
my $result ='';
my $result = '';
foreach my $bucket ( @{ $response->{buckets} } ) {
$result .= $bucket->bucket . "\n";
}
Expand Down
4 changes: 4 additions & 0 deletions lib/Shell/Amazon/S3/Command/setacl.pm
Expand Up @@ -4,6 +4,10 @@ use Perl6::Say;

extends 'Shell::Amazon::S3::Command';

has '+desc' => ( default =>
"setacl ['bucket'|'item'] <id> ['private'|'public-read'|'public-read-write'|'authenticated-read']"
);

override 'validate_tokens', sub {
my ( $self, $tokens ) = @_;
if ( !@{$tokens} == 3 ) {
Expand Down

0 comments on commit c69054c

Please sign in to comment.