App-Term-Jump
view release on metacpan or search on metacpan
lib/App/Term/Jump.pm view on Meta::CPAN
if(defined $weight)
{
if(defined $path)
{
if( -d $weight && ! -d $path)
{
($weight, $path) = ($path, $weight) ;
}
}
else
{
if(-d $weight || $weight !~ /^\d+$/)
{
$path = $weight ;
undef $weight ;
}
}
}
$weight = 1 unless defined $weight ;
if(defined $path)
{
if('.' eq $path)
{
$path = cwd() ;
}
elsif('..' eq $path)
{
$path = Cwd::realpath(File::Spec->updir);
}
else
{
$path = cwd() . '/' . $path unless $path =~ m[^/] ;
}
}
else
{
$path = cwd() ;
}
return ($weight, $path) ;
}
#------------------------------------------------------------------------------------------------------------------------
sub is_blacklisted
{
=head2 [p] is_blacklisted(\%options, $path)
Verifies if the path can be added to the database or not
I<Arguments> -
=over 2
=item * \%options - options parsed from the command line
=item * $path - path to verify
=back
I<Returns> - True if the path can not be added to the database
I<Exceptions> - None
=cut
my ($options, $path) = @_ ;
return grep {$path =~ $_} @{ $options->{black_listed_directories} } ;
}
#------------------------------------------------------------------------------------------------------------------------
sub show_help
{
=head2 [p] show_help()
Extracts the documentation and displays it via I<man>
I<Arguments> - None
I<Returns> - Nothing
I<Exceptions> - Exits the program
=cut
system($ENV{SHELL}, '-c', "man <(pod2man $0)") or warn 'Can\'t display help!' ; ## no critic (InputOutput::ProhibitBacktickOperators)
exit(1) ;
}
#------------------------------------------------------------------------------------------------------------------------
sub do_bash_completion
{
=head2 [p] do_bash_completion($index, $command, \@arguments)
Implements I<Bash> completion for this modules.
I<Arguments> received from bash:
=over 2
=item * $index - index of the command line argument to complete (starting at '1')
=item * $command - a string containing the command name
=item * \@arguments - list of the arguments typed on the command line
=back
=cut
my ($argument_index, $command, @arguments) = @ARGV ;
( run in 2.552 seconds using v1.01-cache-2.11-cpan-5837b0d9d2c )