Changeset 843
- Timestamp:
- 03/27/10 19:11:20 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LATMOS-Accounts/bin/la-cli
r842 r843 76 76 help => 'ls object_type - list object of type object_type', 77 77 completion => sub { 78 if(!$_[ 2]) {78 if(!$_[3]) { 79 79 return grep { /^\Q$_[1]\E/ } $labase->list_supported_objects 80 80 } else { () } … … 136 136 code => sub { 137 137 my ($env, $attr) = @_; 138 foreach (@{$env->{_objects}}) { 139 print $OUT sort map { ($_ || '') . "\n" } $_->get_attributes($attr); 138 if (!$attr) { 139 foreach (@{$env->{_objects}}) { 140 print $OUT $_->dump; 141 } 142 } else { 143 foreach (@{$env->{_objects}}) { 144 print $OUT sort map { ($_ || '') . "\n" } $_->get_attributes($attr); 145 } 140 146 } 141 147 }, … … 155 161 my $prompt = $env->prompt; 156 162 157 $attribs->{completion_function} = sub { 158 $env->complete($_[0], shellwords(substr($_[1], 0, $_[2]))); 159 }; 160 while (defined (my $line = $term->readline($prompt))) { 163 while (1) { 164 $attribs->{completion_function} = sub { 165 $env->complete($_[0], shellwords(substr($_[1], 0, $_[2]))); 166 }; 167 defined (my $line = $term->readline($prompt)) or return; 161 168 $env->run(shellwords($line)); 162 169 $labase->rollback; … … 174 181 my ($class, $env) = @_; 175 182 bless($env, $class); 183 $env->add_func('quit', { help => 'quit - exit the tool', 184 code => sub { print "\n"; exit(0) }, }); 185 $env; 176 186 } 177 187
Note: See TracChangeset
for help on using the changeset viewer.