From fe5b331160d5d58f475ff9ca5501af27c5dd5b5b Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Sun, 30 Oct 2005 05:19:24 +0000 Subject: [PATCH] change sa to a perl script --- sa | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 78 insertions(+), 11 deletions(-) diff --git a/sa b/sa index 1dba922..d652ccc 100755 --- a/sa +++ b/sa @@ -1,15 +1,82 @@ -#!/bin/sh +#!/usr/bin/perl -# sync all script +use warnings; +use strict; -# attempt to sync all known svn projects +use Getopt::Long; +use Pod::Usage; -if [ "$1" == "quick" ]; then - IGNORE="--ignore-externals"; -fi; +=head1 NAME -for dir in ~/ ~/.hide ~/projects/propel ~/bin ~/lib; do - if [ -e $dir/.svn ]; then - svn update $IGNORE $dir; - fi; -done; \ No newline at end of file +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 => 1, + quiet => 0, + debug => 0, + help => 0, + man => 0, + ); + +GetOptions(\%options,'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,$dir); + } +} -- 2.39.2