diff options
| -rwxr-xr-x | sbolint | 30 | 
1 files changed, 18 insertions, 12 deletions
| @@ -54,11 +54,12 @@ Bundling options is supported, e.g. B<-qr> is the same as B<-q -r>.  =item B<-a>, B<--all> -Check all builds in the git repository. This must be run from within a -git tree (e.g. one made with "git clone"). This option also turns on -B<-q> (quiet). Also, if standard output is a terminal, B<sbolint -a> -will exit with a message telling you to redirect standard output to -a file. +Check all builds in the git repository. This must be run from within +a git tree (e.g. one made with "git clone"). This option also turns on +B<-q> (quiet), and (by default) turns off color, though you can enable +it again with B<-c>. Also, if standard output is a terminal, B<sbolint +-a> will redirect stdout to a file called B<sbolint.log.>I<YYYYMMDD> +(the current date).  =item B<-q>, B<--quiet> @@ -346,14 +347,14 @@ $tempdir = 0;  our %info = (); # has to be global, check_info sets it, check_script needs it -# main() { -#check_github_url("testing", $_) for @ARGV; -#exit 0; +# undef means autodetect. -c/-m set it explicitly, -a only affects it if +# it's still undef (if no -c or -m precedes -a on the command line). +$color_output = undef; -$color_output = -t STDOUT; +# main() {  GetOptions( -		"all|a" => \$recursive_git, +		"all|a" => sub { $recursive_git = 1; $color_output = 0 unless defined $color_output; },  		"url-head|u" => \$url_head,  		"download|d" => \$url_download,  		"quiet|q" => \$quiet, @@ -362,11 +363,13 @@ GetOptions(  		"no-notes|n" => \$nonote,  		"no-readme|r" => \$suppress_readme_len,  		"doc|help|h" => sub { exec("perldoc $0"); }, -		"man" => sub { exec("pod2man --stderr -s1 -cSBoStuff -r$VERSION $0"); }, +		"man" => sub { exec("pod2man --stderr -s1 -csbo-maintainer-tools -r$VERSION $0"); },  		"color|colour|c" => sub { $color_output = 1; },  		"mono|no-color|no-colour|m" => sub { $color_output = 0; },  ) or die_usage("Error in command line options"); +$color_output = -t STDOUT unless defined $color_output; +  if(@ARGV && $ARGV[0] eq '-') {  	$stdin = 1;  } @@ -400,7 +403,10 @@ if($stdin) {  if($recursive_git) {  	if(-t STDOUT) { -		die "$SELF: you don't want to use -a without redirecting. Example:\n   $SELF -a > lint.log\n"; +		chomp (my $outfile = "$SELF.log." . `date +%Y%m%d`); +		warn "$SELF: stdout is a terminal, redirecting to $outfile"; +		open my $f, ">$outfile" or die $!; +		*STDOUT = $f;  	}  	@ARGV=(); | 
