#!perl

use 5.010;
use strict;
use warnings;

use App::ProgUtils;
use Perinci::CmdLine::Any -prefer_lite=>1;

our $DATE = '2014-09-16'; # DATE
our $VERSION = '0.12'; # VERSION

our %SPEC;
$SPEC{progless} = {
    v => 1.1,
    summary => 'Show program file with `less`',
    description => <<'_',

Basically

    % progless PROG

is roughly the same as:

    % less `which PROG`

except that it offers tab completion and can also search PROG in the current
directory or normal path (e.g. `progless ../bin/foo`).

_
    args => {
        program => {
            schema => 'str*',
            req => 1,
            pos => 0,
            completion => $App::ProgUtils::_complete_program,
        },
    },
    deps => {
        prog => 'less',
    },
};
sub progless {
    my %args = @_;
    exec "less", App::ProgUtils::_search_program($args{program});
    # [200]; # unreached
}

Perinci::CmdLine::Any->new(
    url => '/main/progless',
)->run;

# ABSTRACT: Show program file with less
# PODNAME: progless

__END__

=pod

=encoding UTF-8

=head1 NAME

progless - Show program file with less

=head1 VERSION

This document describes version 0.12 of progless (from Perl distribution App-ProgUtils), released on 2014-09-16.

=head1 SYNOPSIS

Basic usage:

 % progless mpath

To activate bash completion:

 % complete -C progless progless; # can be put in bash startup file e.g. .bashrc
 % progless mpa<tab>

=head1 HOMEPAGE

Please visit the project's homepage at L<https://metacpan.org/release/App-ProgUtils>.

=head1 SOURCE

Source repository is at L<https://github.com/perlancar/perl-App-ProgUtils>.

=head1 BUGS

Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=App-ProgUtils>

When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.

=head1 AUTHOR

perlancar <perlancar@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by perlancar@cpan.org.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut
