- Timestamp:
- 11/21/10 13:17:09 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
client/trunk/lib/Sophie/Cli.pm
r4 r11 28 28 prompt => sub { 29 29 sprintf('%s - %s - %s > ', 30 $_[0]->{dist}, 31 $_[0]->{vers}, 32 $_[0]->{arch}, 33 ); 34 }, 35 dist => $dist, 36 vers => $vers, 37 arch => $arch, 30 $_[0]->{dist}{distribution}, 31 $_[0]->{dist}{release}, 32 $_[0]->{dist}{arch}, 33 ); 34 }, 35 dist => { 36 distribution => $dist, 37 release => $vers, 38 arch => $arch, 39 }, 38 40 }, 39 41 $base, … … 44 46 my ($self) = @_; 45 47 46 my $res = $self->xmlreq('distrib.struct', $self->{dist},47 $self->{ vers},48 $self->{arch});48 my $res = $self->xmlreq('distrib.struct', 49 $self->{dist}, 50 ); 49 51 print $OUT join ('', map { "$_->{label}\n" } @{ $res->value }); 50 52 } … … 55 57 code => sub { 56 58 my ($self, $media, $path) = @_; 57 my $res = $self->xmlreq('admin.media_path', $self->{dist}, 58 $self->{vers}, 59 $self->{arch}, 59 my $res = $self->xmlreq('admin.media_path', 60 $self->{dist}, 60 61 $media, 61 62 $path, … … 67 68 return (<$start*>) 68 69 } else { 69 my $res = $self->xmlreq('distrib.struct', $self->{dist},70 $self->{ vers},71 $self->{arch});70 my $res = $self->xmlreq('distrib.struct', 71 $self->{dist}, 72 ); 72 73 return map { $_->{label} } @{ $res->value }; 73 74 } … … 75 76 } 76 77 ); 78 $env->add_func('listpath', { 79 code => sub { 80 my ($self, $media) = @_; 81 my $res = $self->xmlreq('admin.list_path', 82 $self->{dist}, 83 $media, 84 ); 85 print $OUT join ('', map { "$_\n" } @{ $res->value }); 86 }, 87 completion => sub { 88 my ($self, $start) = @_; 89 my $res = $self->xmlreq('distrib.struct', 90 $self->{dist}, 91 ); 92 return map { $_->{label} } @{ $res->value }; 93 }, 94 } 95 ); 77 96 $env->add_func('addmedia', { 78 97 code => sub { 79 98 my ($self, $media, $group) = @_; 80 my $res = $self->xmlreq('admin.add_media', $self->{dist}, 81 $self->{vers}, 82 $self->{arch}, 83 $media, 84 $group, 99 my $res = $self->xmlreq('admin.add_media',$self->{dist}, 100 { dist_label => $media, 101 group_label => $group }, 85 102 ); 86 103 print $OUT join ('', map { "$_->{label}\n" } @{ $res->value }); … … 88 105 completion => sub { 89 106 my ($self) = @_; 90 my $res = $self->xmlreq('distrib.struct', $self->{dist},91 $self->{ vers},92 $self->{arch});107 my $res = $self->xmlreq('distrib.struct', 108 $self->{dist}, 109 ); 93 110 return map { $_->{label} } @{ $res->value }; 94 111 }, … … 108 125 code => sub { 109 126 my ($self, $dist, $ver, $arch) = @_; 127 if (!($dist && $ver && $arch)) { 128 print $OUT "missing argument\n"; 129 return; 130 } 110 131 denv($self->base, $dist, $ver, $arch)->cli(); 111 132 },
Note: See TracChangeset
for help on using the changeset viewer.