Psh/Builtins/Dirs.pm untested

filter: Statementstmt 0.0% 0 / 16 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 2 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 30 CC 4 SCAR 28.0
CC
4
Cov
0%
bi_dirs
20.0
BEGIN
2.0
CRAP 16.4
1 package Psh::Builtins::Dirs;
2  
3 require Psh::Support::Dirs;
4  
5 =item * C<dirs> [n]
6  
7 Prints out [the last n] entries in the cd history
8  
9 =cut
10  
11 sub bi_dirs {
12 my $max=$#Psh::Support::Dirs::stack;
13 if ($_[0] && $_[0]=~/^\d+$/) {
14 $max=$_[0]-1 if $_[0]<=$max;
15 }
16  
17 for (my $i=$max; $i>=0; $i--) {
18 printf "%%%-2d ",$i;
19
20 if ($i==$Psh::Support::Dirs::::stack_pos) {
21 print " > ";
22 } else {
23 print " ";
24 }
25 print $Psh::Support::Dirs::stack[$i]."\n";
26 }
27  
28 return (1,undef);
29 }
30  
31 1;
32  
33 # Local Variables:
34 # mode:perl
35 # tab-width:4
36 # indent-tabs-mode:t
37 # c-basic-offset:4
38 # perl-label-offset:0
39 # perl-indent-level:4
40 # cperl-indent-level:4
41 # cperl-label-offset:0
42 # End: