#!/usr/bin/perl use warnings; use strict; use Getopt::Long; use Pod::Usage; =head1 NAME sa - sync all =head1 SYNOPSIS sa [options] [status|update|checkout] [directories to sync] Options: --quick, -Q don't update external projects --quiet, -q be quiet --debug, -d debugging level (Default 0) --help, -h display this help --man, -m display manual =head1 OPTIONS =over =item B<--debug, -d> Debug verbosity. (Default 0) =item B<--help, -h> Display brief useage information. =item B<--man, -m> Display this manual. =back =head1 EXAMPLES =cut use User; use vars qw($DEBUG); # XXX parse config file my %options = (quick => 0, quiet => 1, debug => 0, help => 0, man => 0, ); GetOptions(\%options,'quick|Q!','quiet|q!','debug|d+','help|h|?','man|m'); pod2usage() if $options{help}; pod2usage({verbose=>2}) if $options{man}; $DEBUG = $options{debug}; my $command; if (@ARGV and $ARGV[0] =~ /^(st(?:atus)?|up(?:date)?|checkout)$/) { $command = $ARGV[0]; } else { $command = 'status'; } my $HOME=User->Home; for my $dir (map{"${HOME}/$_"} '',qw(.hide bin lib)) { if (-e "$dir/.svn") { system('svn', $command, $options{quiet}?'-q':(), $options{quick}?('--ignore-externals','-N'):(), $dir, ); } }