Created
September 1, 2016 20:13
-
-
Save autarch/a62812d2be4e6d5c6380db1b4e8217d7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/home/autarch/perl5/perlbrew/perls/perl-5.24.0/bin/perl | |
| use strict; | |
| use warnings; | |
| use lib '/home/autarch/.perlbrew/libs/perl-5.24.0@dev/lib/perl5'; | |
| use Getopt::Long qw( :config pass_through ); | |
| use Perl::Tidy 20120714; | |
| use Path::Class qw( file ); | |
| my $file; | |
| GetOptions( 'file:s' => \$file ); | |
| $ENV{PERL5LIB} = join ':', | |
| grep {defined} ( | |
| '/home/autarch/.perlbrew/libs/perl-5.24.0@dev/lib/perl5', | |
| ( $ENV{PERL5LIB} ? split /:/, $ENV{PERL5LIB} : () ), | |
| ); | |
| my $perltidy = '/home/autarch/.perlbrew/libs/perl-5.24.0@dev/bin/perltidy'; | |
| if ($file) { | |
| my $dir = file($file)->dir(); | |
| my $profile = q{}; | |
| DIR: | |
| while ( $dir ne '/' ) { | |
| for my $file ( | |
| $dir->file('perltidyrc'), $dir->file('.perltidyrc'), | |
| $dir->file('.perltidyallrc') | |
| ) { | |
| if ( -f $file ) { | |
| $profile = "-pro=$file"; | |
| last DIR; | |
| } | |
| } | |
| $dir = $dir->parent(); | |
| } | |
| exec "$perltidy $profile @ARGV"; | |
| } | |
| else { | |
| exec "$perltidy @ARGV"; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment