#!perl

use strict;
use warnings;
use App::PRT::CLI;

my $cli = App::PRT::CLI->new;
$cli->set_io(*STDIN, *STDOUT);
$cli->parse(@ARGV);
$cli->run;
__END__

=encoding utf-8

=head1 NAME

prt - Command line frontend of App::PRT

=head1 SYNOPSIS

    $ prt <command> <args>
    $ prt <command> <args> <files>

=head1 DESCRIPTION

prt is the command line frontend of L<App::PRT>.

=head1 SUBCOMMANDS

=over 4

=item * replace_token

Replace C<foo> token with C<bar>.

    prt replace_token foo bar

Replace C<foo> token with C<bar> but target statements must have C<bazz> token.

    prt replace_token foo bar --in-statement bazz

=item * rename_class

Rename C<Foo> class to C<Bar> class.

    prt rename_class Foo Bar

=item * rename_namespace

Rename C<Foo> and C<Foo::*> classes to C<Bar> and C<Bar::*> classes.

    prt rename_namespace Foo Bar

=item * delete_method

Delete C<eat> method from C<Food> class.

    prt delete_method Food eat

=item * move_class_method

Move C<method> method in C<Class> class to C<another_method> method in C<AnotherClass>.
C<Class>'s including packages are copied to C<AnotherClass>.

    prt move_class_method 'Class#method' 'AnotherClass#another_method'

=item * introduce_variables

Print the variables in the source code. This command accepts input from C<STDIN>.

    prt introduce_variables a.pl
    cat a.pl | prt introduce_variables
    pbpaste | prt introduce_variables

=item * list_files

List the files that C<App::PRT> would process.  This can be used, for example,
to search the contents of the Perl sources in a project:

    grep "some_regex" `prt list_files`

The C<-0> argument causes outputs to be separated by C<\0> instead of the
default C<\n>.  For example:

    prt list_files -0 | xargs -0 grep "some_regex"

=back

=head1 TARGET FILES

You can specify the target files to refactor.  For example:

    prt replace_token foo bar lib/**/*.pm t/*.t # Refactor Perl modules in lib/ and test files in t/

NOTE: C<App::PRT> does not glob (expand wildcards).  In the above command,
the shell must expand the C<**/*.pm> and C<*.t>.

Without target files, C<App::PRT> detects source files in your project automatically.
C<App::PRT> looks for a C<cpanfile> to detect the project's root directory.
When executed in a git repository, all files in the repository are used.

    prt replace_token foo bar   # Refactor the project in current working directory

=head1 LICENSE

Copyright (C) 2014-2019 hitode909 and contributors.

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

=head1 AUTHOR

hitode909 E<lt>hitode909@gmail.comE<gt>

=cut
