Psh/Builtins/Fallback/Ls.pm untested

filter: Statementstmt 0.0% 0 / 8 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 1 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 22 CC 3 SCAR 24.8
CC
3
Cov
0%
bi_ls
12.0
CRAP 12.0
1 package Psh::Builtins::Fallback::Ls;
2  
3 =item * C<ls>
4  
5 Shows the files in the current directory
6  
7 =cut
8  
9 sub bi_ls
10 {
11 my $pattern= shift || '*';
12 my $ps= $Psh::OS::FILE_SEPARATOR;
13 $pattern.=$ps.'*' if( $pattern !~ /\*/ &&
14 -d Psh::Util::abs_path($pattern));
15 my @files= map {
16 return $1 if( m:\Q$ps\E([^\Q$ps\E]+)$:); $_
17 } Psh::OS::glob($pattern);
18 Psh::Util::print_list(sort @files);
19 return (1,undef);
20 }
21  
22 1;