]> git.donarmstrong.com Git - bin.git/commitdiff
make sa use the sa.d dir
authorDon Armstrong <don@donarmstrong.com>
Fri, 17 Feb 2006 08:43:40 +0000 (08:43 +0000)
committerDon Armstrong <don@donarmstrong.com>
Fri, 17 Feb 2006 08:43:40 +0000 (08:43 +0000)
sa

diff --git a/sa b/sa
index a8da86b179084620d396ae960b550dc22f48567b..74af5e506a4b65274ff5e88d8d7274f71ba00de7 100755 (executable)
--- a/sa
+++ b/sa
@@ -66,11 +66,11 @@ pod2usage({verbose=>2}) if $options{man};
 =head1 CONFIGURATION
 
 Reads configuration information from Start by parsing /etc/sa.conf,
-then ~/.sarc then ~/.sarc_$hostname, then ~/.sarc_local
+then the contents of ~/sa.d/ which match ^[\w\d][\w\d_-.]+$
 
 The configuration file contains a list of svn repositories which
 should be queried; each line can contain a tab, which indicates that
-the command following the tab should be run fater the svn directory is
+the command following the tab should be run after the svn directory is
 updated.
 
 The configuration files are read in the order given above.
@@ -91,7 +91,6 @@ sub parse_config_file {
      }
 }
 
-
 my $HOME=User->Home;
 my $HOSTNAME=qx(hostname);
 $HOSTNAME=~s/\n//g;
@@ -101,8 +100,19 @@ if ($1 > 13838) {
      $CAN_IGNORE_EXTERNALS = 1;
 }
 
+sub available_config_files{
+     my $dir = new IO::Dir "$HOME/.sa.d/";
+     my @conffiles;
+     my $file;
+     while (defined($file = $dir->read)) {
+         next unless $file =~ /^[\w\d][\w\d_-.]+$/;
+         push @conffiles,$file;
+     }
+     return @conffiles;
+}
+
 my %repos;
-for ('/etc/sa.conf', "${HOME}/.sarc", "${HOME}/.sarc_${HOSTNAME}", "${HOME}/.sarc_local") {
+for ('/etc/sa.conf', available_config_files()) {
      if (-e $_) {
          parse_config_file(\%repos,$_,$HOME);
      }