[libcode-tidyall-perl] 229/374: add --conf-name; specify which options take arguments in docs

Jonas Smedegaard js at alioth.debian.org
Sun Sep 29 22:26:25 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 95322aee077e977d24a75e497a46448da25b9a83
Author: Jonathan Swartz <swartz at pobox.com>
Date:   Fri Sep 14 11:18:44 2012 -0400

    add --conf-name; specify which options take arguments in docs
---
 bin/tidyall |   56 ++++++++++++++++++++++++++++++++++++--------------------
 1 file changed, 36 insertions(+), 20 deletions(-)

diff --git a/bin/tidyall b/bin/tidyall
index ef1c031..ae6ab72 100755
--- a/bin/tidyall
+++ b/bin/tidyall
@@ -4,7 +4,7 @@ use Getopt::Long;
 use Pod::Usage;
 use Capture::Tiny qw(capture_merged);
 use Code::TidyAll;
-use Code::TidyAll::Util qw(can_load dirname);
+use Code::TidyAll::Util qw(can_load dirname rel2abs);
 use strict;
 use warnings;
 
@@ -16,11 +16,13 @@ sub usage {
 }
 
 my ( %params, $all_files, $conf_file, $git_files, $help, $inc_dirs, $list, $pipe, $svn_files );
+my $conf_name = 'tidyall.ini';
 
 GetOptions(
     'backup-ttl=i'    => \$params{backup_ttl},
     'check-only'      => \$params{check_only},
     'conf-file=s'     => \$conf_file,
+    'conf-name=s'     => \$conf_name,
     'data-dir=s'      => \$params{data_dir},
     'no-backups'      => \$params{no_backups},
     'no-cache'        => \$params{no_cache},
@@ -60,7 +62,7 @@ if ($pipe) {
 elsif ( ( $all_files || $svn_files || $git_files ) ) {
     die "cannot use filename(s) with -a/--all, -s/--svn, or -g/--git"
       if @ARGV;
-    $conf_file ||= $tidyall_class->find_conf_file( cwd() );
+    $conf_file ||= $tidyall_class->find_conf_file( $conf_name, cwd() );
     $ct = $tidyall_class->new_from_conf_file( $conf_file, %params );
 
     if ($all_files) {
@@ -76,7 +78,7 @@ elsif ( ( $all_files || $svn_files || $git_files ) ) {
     }
 }
 elsif ( @files = @ARGV ) {
-    $conf_file ||= $tidyall_class->find_conf_file( dirname( $files[0] ) );
+    $conf_file ||= $tidyall_class->find_conf_file( $conf_name, dirname( $files[0] ) );
     $ct = $tidyall_class->new_from_conf_file( $conf_file, %params );
 }
 else {
@@ -98,7 +100,7 @@ sub handle_pipe {
     $params{$_} = 1 for ( 'no_backups', 'no_cache', 'quiet' );
     $params{$_} = 0 for ('verbose');
 
-    $conf_file ||= $tidyall_class->find_conf_file( dirname($pipe_filename) );
+    $conf_file ||= $tidyall_class->find_conf_file( $conf_name, 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> };
@@ -108,7 +110,7 @@ sub handle_pipe {
     #
     my $result;
     my $output = capture_merged {
-        $result = $ct->process_source( $source, $ct->_small_path( realpath($pipe_filename) ) );
+        $result = $ct->process_source( $source, $ct->_small_path( rel2abs($pipe_filename) ) );
     };
     print STDERR $output;
 
@@ -243,6 +245,9 @@ C<tidyall> will expect to find C<tidyall.ini> in the specified root directory.
 
 =back
 
+You can also pass --conf-name to change the name that is searched for, or
+--conf-file to specify an explicit path.
+
 =head1 CONFIGURATION
 
 The config file (C<tidyall.ini>) is in L<Config::INI|Config::INI> format.
@@ -382,10 +387,16 @@ whether files are cached. Generally used with -a, -g, or -s. e.g.
 Optional mode that can affect which plugins run. Defaults to 'cli'. See
 L</MODES>.
 
-=item -p, --pipe
+=item -p path, --pipe path
+
+Read content from STDIN instead of from a file. This option takes a filename
+argument, relative or absolute, which will be used to determine which plugins
+to apply and also where to start looking upwards for the configuration file. 
+The file will not actually be read and does need even need to exist.
 
-Read content from STDIN, and write either the tidied content to STDOUT or the
-error message to STDERR.
+If an error occurs, it will be output to STDERR and tidyall will exit with
+status 1. Otherwise, the tidied content will be output to STDOUT and tidyall
+will exit with status 0.
 
 When specifying this option you must specify exactly one filename, relative or
 absolute, which will be used to determine which plugins to apply and also where
@@ -413,15 +424,16 @@ Suppress output except for errors.
 
 Show extra output.
 
-=item -I
+=item -I I<path1,path2,...>
 
-Add libraries to @INC, as Perl's -I. Useful if --tidyall-class or plugins are
-in an alternate lib directory.
+Add one or more library paths to @INC, like Perl's -I. Useful if
+--tidyall-class or plugins are in an alternate lib directory.
 
-=item --backup-ttl     
+=item --backup-ttl I<duration>
 
-Amount of time before backup files can be purged; defaults to "1h". Can be any
-string recognized by L<Time::Duration::Parse|Time::Duration::Parse>.
+Amount of time before backup files can be purged. Can be a number of seconds or
+any string recognized by L<Time::Duration::Parse|Time::Duration::Parse>, e.g.
+"4h" or "1day". Defaults to "1h".
 
 =item --check-only     
 
@@ -431,12 +443,16 @@ not. This is used by L<Test::Code::TidyAll|Test::Code::TidyAll> and the
 L<svn|Code::TidyAll::SVN::Precommit> and L<git|Code::TidyAll::Git::Precommit>
 pre-commit hooks, for example, to enforce that you've tidied your files.
 
-=item --conf-file      
+=item --conf-file I<path>
+
+Specify relative or absolute path to conf file, instead of searching for it in
+the usual way.
+
+=item --conf-name I<name>
 
-Specify config file explicitly. Usually this is inferred from the specified
-file(s) or from the current working directory.
+Specify a conf file name to search for instead of C<tidyall.ini>.
 
-=item --data-dir       
+=item --data-dir I<path>
 
 Contains data like backups and cache. Defaults to root_dir/.tidyall.d
 
@@ -449,7 +465,7 @@ Don't backup files before processing.
 Don't cache last processed times; process all files every time. See also
 C<--refresh-cache>.
 
-=item --output-suffix  
+=item --output-suffix I<suffix>
 
 Suffix to add to a filename before outputting the modified version, e.g.
 ".tdy". Default is none, which means overwrite the file.
@@ -464,7 +480,7 @@ info. See also C<--no-cache>.
 Specify root dir explicitly. Usually this is inferred from the specified files
 or the current working directory.
 
-=item --tidyall-class  
+=item --tidyall-class I<class>
 
 Subclass to use instead of C<Code::TidyAll>.
 

-- 
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