- Timestamp:
- 02/21/19 22:13:00 (5 years ago)
- Location:
- trunk/LATMOS-Accounts/lib/LATMOS/Accounts
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Cli.pm
r2209 r2216 153 153 print $OUT "Selecting $otype " . join(', ', @ids) . "\n"; 154 154 LATMOS::Accounts::Cli::Object->new( 155 Parent => $self, 155 156 Context => $self->Context, 156 157 otype => $otype, -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Cli/Base.pm
r2215 r2216 27 27 28 28 has Context => ( is => 'ro', isa => 'LATMOS::Accounts::Cli::Context' ); 29 has Parent => ( is => 'ro' ); 29 30 30 31 =head1 FUNCTIONS … … 379 380 my ($self, $lastw, $name, @args) = @_; 380 381 if (!$name) { 381 return grep { /^\Q$lastw\E/ } sort 382 (keys %{ $self->{funcs} || {}}); 382 if ($lastw =~ m!^\.\./?(.*)$!) { 383 if ($self->Parent) { 384 return map { "../$_" } $self->Parent->complete($1, $name, @args); 385 } else { 386 return (); 387 } 388 } else { 389 return grep { /^\Q$lastw\E/ } sort 390 (keys %{ $self->{funcs} || {}}); 391 } 392 } elsif ($name =~ m!^../(.*)$!) { 393 if ($self->Parent) { 394 return $self->Parent->complete($lastw, $1, @args); 395 } else { 396 return (); 397 } 383 398 } elsif ($self->{funcs}{$name}{alias}) { 384 399 $self->complete($lastw, @{$self->{funcs}{$name}{alias}}, @args); … … 400 415 return if (!$name); 401 416 402 if (grep { m/^(-h|--help)$/ } @args) { 417 if ($name =~ m!^../(.*)$!) { 418 if ($self->Parent) { 419 $self->Parent->run($1, @args); 420 } else { 421 $self->print("No parent envirronment to call function\n"); 422 } 423 } elsif (grep { m/^(-h|--help)$/ } @args) { 403 424 $self->Help($name); 404 425 } elsif (!exists($self->{funcs}{$name})) { -
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Cli/Object.pm
r2213 r2216 370 370 print $OUT "Selecting $env->otype " . join(', ', map { $_->id } @objs) . "\n"; 371 371 LATMOS::Accounts::Cli::Object->new( 372 Parent => $self, 372 373 Context => $env->Context, 373 374 otype => $totype, … … 511 512 my $name = shift or return; 512 513 513 if (!exists($self->{funcs}{$name})) { 514 $self->print("No command $name found\n"); 515 } elsif (my $otype = $self->{funcs}{$name}{proxy}) { 514 if (my $otype = $self->{funcs}{$name}{proxy}) { 516 515 $self->Context->{objs} = $self->objs; 517 516 LATMOS::Accounts::Cli->new( 517 Parent => $self, # Look useless 518 518 Context => $self->Context, 519 519 )->run(
Note: See TracChangeset
for help on using the changeset viewer.