App-TEWK-tt
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
#!/Users/tewk/perl5/perlbrew/perls/perl-5.24.0/bin/perl
use Modern::Perl;
use File::Find;
#use File::Find::Rule;
use Cwd;
use Cwd qw( abs_path);
use List::Util qw(min);
use List::MoreUtils qw(each_array);
use Term::ANSIColor;
use Term::ReadKey;
use IO::All;
my $dir = getcwd;
sub pick
{
my @files = @_;
my @keys = '0' .. '9';
push( @keys, 'a' .. 'z' );
push( @keys, 'A' .. 'Z' );
#push( @keys, (split //, '!"#%&\'()*+,-./:;<=>?@[\]^_`{|}~' ) );
my %hash;
if( ($#files + 1) > 62 )
{
@keys = ();
for( my $i = 0; $i <= $#files; ++$i )
{
push @keys, sprintf( "%03d", $i );
}
}
@files = @files[0 .. min( $#files, $#keys ) ];
@hash{ @keys[ 0 .. $#files ] } = @files;
my @a =@keys[ 0 .. $#files ];
my $it = each_array( @a, @files );
while ( my ($first, $second) = $it->()) {
my $s = " $second";
chomp( $s );
say colored(['bright_red'], "$first" ), $s;
}
if( ($#files + 1) > 62 )
{
my @k;
for( my $i = 0; $i <= 2; ++$i )
{
ReadMode('cbreak');
push @k, ReadKey(0);
ReadMode('normal');
}
say join( '', @k );
return $hash{ join( '', @k ) };
}
else
{
ReadMode('cbreak');
my $key = ReadKey(0);
ReadMode('normal');
return $hash{ $key };
}
}
#say join( " ", @keys );
#my @files = File::Find::Rule->executable()->maxdepth(1)->name( qr/^Test_[^\.]*/ )->in( "." );
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.033 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )