Changeset 2212 for trunk/LATMOS-Accounts/lib/LATMOS
- Timestamp:
- 02/21/19 13:55:28 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Cli/Base.pm
r2211 r2212 26 26 27 27 =head1 FUNCTIONS 28 29 =cut 30 31 =head1 CLI FUNCTIONS 28 32 29 33 =cut … … 162 166 }); 163 167 164 $self->add_func( 165 'query' => { 168 $self->add_func( 'query' => { 166 169 proxy => '*', 167 170 help => 'show attribute', … … 169 172 code => sub { 170 173 my $env = shift; 171 my @args = $self->getoption({ 'o|object=s' => \my $otype }, @_); 174 my @args = $self->getoption( 175 { 176 'o|object=s' => \my $otype, 177 'e|empty' => \my $empty_attr, 178 'ro' => \my $with_ro, 179 'fmt=s' => \my $fmt, 180 'filefmt=s' => \my $filefmt, 181 }, @_ 182 ); 172 183 $otype ||= 'user'; 173 184 … … 177 188 foreach my $name (@args) { 178 189 my $obj = $self->base->get_object( $otype, $name) or do { 190 $self->print("Cannot get object $otype/$name\n"); 179 191 next; 180 192 }; … … 183 195 } 184 196 197 if ($filefmt){ 198 open(my $hfmt, '<', $filefmt) or die "Cannot open $filefmt\n"; 199 $fmt ||= ''; # avoid undef warning 200 while (<$hfmt>) { 201 chomp($fmt .= $_); 202 } 203 close $hfmt; 204 } 205 185 206 foreach (@{ $objs }) { 186 $self->print($_->dump); 207 if ($fmt) { 208 $self->print($_->queryformat($fmt)); 209 } else { 210 $_->text_dump( $self->Context->Out, { 211 empty_attr => $empty_attr, 212 only_rw => !$with_ro, 213 } ); 214 } 187 215 } 188 216 }, 189 } 190 ); 217 } ); 191 218 } 192 219
Note: See TracChangeset
for help on using the changeset viewer.