Commit | Line | Data |
---|---|---|
86530b38 AT |
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; |