line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# -*- coding: utf-8 -*- |
2
|
|
|
|
|
|
|
# Copyright (C) 2011-2012, 2014 Rocky Bernstein <rocky@cpan.org> |
3
|
|
|
|
|
|
|
|
4
|
12
|
|
|
12
|
|
93
|
use warnings; no warnings 'redefine'; |
|
12
|
|
|
12
|
|
29
|
|
|
12
|
|
|
1
|
|
373
|
|
|
12
|
|
|
1
|
|
57
|
|
|
12
|
|
|
|
|
28
|
|
|
12
|
|
|
|
|
331
|
|
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
5
|
12
|
|
|
12
|
|
60
|
use rlib '../../../..'; |
|
12
|
|
|
1
|
|
21
|
|
|
12
|
|
|
|
|
64
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Devel::Trepan::CmdProcessor::Command::Unalias; |
8
|
12
|
|
|
12
|
|
4627
|
use if !@ISA, Devel::Trepan::CmdProcessor::Command ; |
|
12
|
|
|
1
|
|
27
|
|
|
12
|
|
|
|
|
64
|
|
|
1
|
|
|
|
|
370
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
unless (@ISA) { |
11
|
12
|
|
|
12
|
|
77
|
eval <<'EOE'; |
|
12
|
|
|
12
|
|
28
|
|
|
12
|
|
|
12
|
|
633
|
|
|
12
|
|
|
12
|
|
72
|
|
|
12
|
|
|
12
|
|
31
|
|
|
12
|
|
|
|
|
541
|
|
|
12
|
|
|
|
|
83
|
|
|
12
|
|
|
|
|
25
|
|
|
12
|
|
|
|
|
572
|
|
|
12
|
|
|
|
|
81
|
|
|
12
|
|
|
|
|
28
|
|
|
12
|
|
|
|
|
545
|
|
|
12
|
|
|
|
|
89
|
|
|
12
|
|
|
|
|
23
|
|
|
12
|
|
|
|
|
514
|
|
12
|
|
|
|
|
|
|
use constant CATEGORY => 'support'; |
13
|
|
|
|
|
|
|
use constant SHORT_HELP => 'Remove an alias'; |
14
|
|
|
|
|
|
|
use constant MIN_ARGS => 0; # Need at least this many |
15
|
|
|
|
|
|
|
use constant MAX_ARGS => undef; # Need at most this many - undef -> unlimited. |
16
|
|
|
|
|
|
|
use constant NEED_STACK => 0; |
17
|
|
|
|
|
|
|
EOE |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
12
|
|
|
12
|
|
2040
|
use strict; use vars qw(@ISA); @ISA = @CMD_ISA; |
|
12
|
|
|
12
|
|
29
|
|
|
12
|
|
|
1
|
|
322
|
|
|
12
|
|
|
1
|
|
61
|
|
|
12
|
|
|
|
|
25
|
|
|
12
|
|
|
|
|
721
|
|
|
1
|
|
|
|
|
47
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
49
|
|
21
|
12
|
|
|
12
|
|
74
|
use vars @CMD_VARS; # Value inherited from parent |
|
12
|
|
|
1
|
|
30
|
|
|
12
|
|
|
|
|
5024
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
372
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $NAME = set_name(); |
24
|
|
|
|
|
|
|
=pod |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head2 Synopsis: |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
29
|
|
|
|
|
|
|
our $HELP = <<'HELP'; |
30
|
|
|
|
|
|
|
=pod |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
B<unalias> I<alias1> [I<alias2> ...] |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Remove alias I<alias1> and so on. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head2 Example: |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
unalias s # Remove 's' as an alias for 'step' |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 See also: |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
L<C<alias>|Devel::Trepan::CmdProcessor::Command::Alias>, and |
43
|
|
|
|
|
|
|
L<C<show aliases>|Devel::Trepan::CmdProcessor::Command::Show::Aliases>. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
46
|
|
|
|
|
|
|
HELP |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
our $ARGS = 1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub complete($$) |
51
|
|
|
|
|
|
|
{ |
52
|
0
|
|
|
0
|
0
|
|
my ($self, $prefix) = @_; |
|
0
|
|
|
0
|
0
|
|
|
53
|
0
|
|
|
|
|
|
my $proc = $self->{proc}; |
|
0
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
my @candidates = keys %{$proc->{aliases}}; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my @matches = |
|
0
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Devel::Trepan::Complete::complete_token(\@candidates, $prefix); |
57
|
0
|
|
|
|
|
|
sort @matches; |
|
0
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# Run command. |
61
|
|
|
|
|
|
|
sub run($$) { |
62
|
0
|
|
|
0
|
0
|
|
my ($self, $args) = @_; |
|
0
|
|
|
0
|
0
|
|
|
63
|
0
|
|
|
|
|
|
my $proc = $self->{proc}; |
|
0
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
my @args = @$args; shift @args; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
for my $arg (@args) { |
|
0
|
|
|
|
|
|
|
66
|
0
|
0
|
|
|
|
|
if (exists $proc->{aliases}{$arg}) { |
|
0
|
0
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
my $command_name = $proc->{aliases}{$arg}; |
|
0
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
$proc->remove_alias($command_name, $arg); |
|
0
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
$proc->msg("Alias for ${arg} removed."); |
|
0
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
} else { |
71
|
0
|
|
|
|
|
|
$proc->msg("No alias found for ${arg}."); |
|
0
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
unless (caller) { |
77
|
|
|
|
|
|
|
# Demo it. |
78
|
|
|
|
|
|
|
require Devel::Trepan::CmdProcessor::Mock; |
79
|
|
|
|
|
|
|
my $proc = Devel::Trepan::CmdProcessor::Mock::setup(); |
80
|
|
|
|
|
|
|
my $cmd = __PACKAGE__->new($proc); |
81
|
|
|
|
|
|
|
$cmd->run([$NAME, 's']); |
82
|
|
|
|
|
|
|
$cmd->run([$NAME, 's']); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |