| 1 | # Copyright (C) 2012 Rocky Bernstein <rocky@cpan.org> | ||
| 2 | # Part of Trepan::CmdProcess that deails with alias routines | ||
| 3 | 12 | ▶ | use rlib '../../..'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | package Devel::Trepan::CmdProcessor; | ||
| 6 | |||
| 7 | 0 | ▶ | sub add_alias($$$) { |
|
Subroutine
add_alias: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 8 | 0 | ▶ | my ($self, $command_name, $alias, $cmd_str) = @_; |
|
Subroutine
add_alias: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 9 | |||
| 10 | # Update array inside command name | ||
| 11 | 0 | my $cmd_alias_ref = $self->{commands}{$command_name}{aliases}; | |
| 12 | 0 | push @$cmd_alias_ref, $alias; | |
| 13 | |||
| 14 | # Upate aliases hash | ||
| 15 | 0 | $self->{aliases}{$alias} = $cmd_str; | |
| 16 | } | ||
| 17 | |||
| 18 | 0 | ▶ | sub remove_alias($$$) { |
|
Subroutine
remove_alias: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 19 | 0 | ▶ | my ($self, $command_name, $alias) = @_; |
|
Subroutine
remove_alias: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 20 | |||
| 21 | # Update array inside command name | ||
| 22 | 0 | my $cmd_alias_ref = $self->{commands}{$command_name}{aliases}; | |
| 23 | 0 | my @new_aliases = grep(($alias ne $_), @$cmd_alias_ref); | |
| 24 | 0 | $self->{commands}{$command_name}{aliases} = \@new_aliases; | |
| 25 | |||
| 26 | # Upate aliases hash | ||
| 27 | 0 | delete $self->{aliases}{$alias}; | |
| 28 | } | ||
| 29 | |||
| 30 | 12 | 1; | |