[libcode-tidyall-perl] 192/374: --pipe fixes
Jonas Smedegaard
js at alioth.debian.org
Sun Sep 29 22:26:17 UTC 2013
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository libcode-tidyall-perl.
commit 4b808d74c1ce802abfebe443c74212eda33ecc15
Author: Jonathan Swartz <swartz at pobox.com>
Date: Thu Sep 6 12:55:47 2012 -0700
--pipe fixes
---
bin/tidyall | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/bin/tidyall b/bin/tidyall
index d84b0e5..1cc1bcd 100755
--- a/bin/tidyall
+++ b/bin/tidyall
@@ -10,9 +10,9 @@ use warnings;
sub usage {
my $msg = shift;
- print "$msg\n" if $msg;
+ print STDERR "$msg\n" if $msg;
require Pod::Usage;
- Pod::Usage::pod2usage( { verbose => 1 } );
+ Pod::Usage::pod2usage( { verbose => 1, output => \*STDERR } );
}
my ( %params, $all_files, $conf_file, $git_files, $help, $inc_dirs, $pipe, $svn_files );
@@ -39,11 +39,6 @@ GetOptions(
'I' => \$inc_dirs,
) or usage();
-if ($pipe) {
- $params{$_} = 1 for ( 'no_backups', 'no_cache', 'quiet' );
- $params{$_} = 0 for ('verbose');
-}
-
Pod::Usage::pod2usage( { verbose => 2 } ) if $help;
unshift( @INC, split( /\s*,\s*/, $inc_dirs ) ) if defined($inc_dirs);
@@ -92,12 +87,16 @@ my $status = ( grep { $_->error } @results ) ? 1 : 0;
exit($status);
sub handle_pipe {
- my ($pipe) = @_;
+ my ($pipe_filename) = @_;
- $conf_file ||= $tidyall_class->find_conf_file( dirname($pipe) );
- my $ct = $tidyall_class->new_from_conf_file( $conf_file, %params );
- my $source = scalar(<STDIN>);
- my $result = $ct->process_source( $source, $pipe );
+ $params{$_} = 1 for ( 'no_backups', 'no_cache', 'quiet' );
+ $params{$_} = 0 for ('verbose');
+
+ $conf_file ||= $tidyall_class->find_conf_file( dirname($pipe_filename) );
+ my $ct = $tidyall_class->new_from_conf_file( $conf_file, %params );
+ my $root_dir = $ct->root_dir;
+ my $source = do { local $/; <STDIN> };
+ my $result = $ct->process_source( $source, $ct->_small_path($pipe_filename) );
if ( my $error = $result->error ) {
print STDERR $error;
exit(1);
@@ -106,6 +105,10 @@ sub handle_pipe {
print STDERR "No match for '$pipe'";
exit(1);
}
+ elsif ( $result->state eq 'checked' ) {
+ print $source;
+ exit(0);
+ }
else {
print $result->new_contents;
exit(0);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcode-tidyall-perl.git
More information about the Pkg-perl-cvs-commits
mailing list