Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / lib / site_perl / 5.8.0 / Psh / Builtins / Unalias.pm
CommitLineData
86530b38
AT
1package Psh::Builtins::Unalias;
2
3require Psh::Util;
4require Psh::Support::Alias;
5
6=item * C<unalias NAME | -a | all]>
7
8Removes the alias with name <C<I<NAME>> or all aliases if either <C<I<-a>>
9(for bash compatibility) or <C<I<all>> is specified.
10
11=cut
12
13sub bi_unalias {
14 my $name= shift;
15 if( ($name eq '-a' || $name eq 'all') and !Psh::Support::Alias::is_aliased($name) ) {
16 %Psh::Support::Alias::aliases=();
17 return (1,undef);
18 } elsif( Psh::Support::Alias::is_aliased($name)) {
19 delete($Psh::Support::Alias::aliases{$name});
20 return (1,undef);
21 } else {
22 Psh::Util::print_error_i18n('unalias_noalias', $name);
23 return (0,undef);
24 }
25 return (0,undef);
26}
27
28
29sub cmpl_unalias {
30 my $text= shift;
31 return (1,grep { Psh::Util::starts_with($_,$text) } Psh::Support::Alias::get_alias_commands());
32}
33
341;