Author: sparky
Date: Thu Oct  1 21:29:44 2009
New Revision: 10649

Modified:
   toys/rsget.pl/RSGet/AutoUpdate.pm
   toys/rsget.pl/RSGet/Curl.pm
   toys/rsget.pl/RSGet/Get.pm
   toys/rsget.pl/RSGet/Line.pm
   toys/rsget.pl/RSGet/Main.pm
   toys/rsget.pl/RSGet/Processor.pm
   toys/rsget.pl/rsget.pl
Log:
- --help


Modified: toys/rsget.pl/RSGet/AutoUpdate.pm
==============================================================================
--- toys/rsget.pl/RSGet/AutoUpdate.pm   (original)
+++ toys/rsget.pl/RSGet/AutoUpdate.pm   Thu Oct  1 21:29:44 2009
@@ -27,15 +27,17 @@
        mkdir $svn_dir unless -d $svn_dir;
        chdir $svn_dir or die "Can't chdir to '$svn_dir'\n";
 
-       warn "Updating from SVN\n";
+       print "Updating from SVN:\n";
        my $svn_uri = setting("svn_uri");
        my $updated = 0;
        foreach my $dir ( qw(data RSGet Get Link) ) {
                my $last;
+               print "  $dir:\n";
                open SVN, "-|", "svn", "co", "$svn_uri/$dir";
                while ( <SVN> ) {
+                       print "    " . $_;
                        chomp;
-                       $updated++ if /^.{4}\s+$dir/;
+                       $updated++;
                        $last = $_;
                }
                close SVN;
@@ -45,6 +47,8 @@
        }
        chdir $start_dir;
 
+       $updated -= 4;
+       return undef unless $updated >= 0;
        return $updated;
 }
 

Modified: toys/rsget.pl/RSGet/Curl.pm
==============================================================================
--- toys/rsget.pl/RSGet/Curl.pm (original)
+++ toys/rsget.pl/RSGet/Curl.pm Thu Oct  1 21:29:44 2009
@@ -16,9 +16,9 @@
        backup => [ "Make backups if downloaded file exists.",
        "copy,move", qr/copy,move|copy|move|no/ ],
        backup_suf => [ "Rename backup files with specified suffix. " .
-               "If none defined file extension won't be changed",
+               "If none defined -N will be added to file name, without 
disrupting file extension.",
                undef, qr/.+/ ],
-       outdir => [ "Output directory; where finished files are moved.", '.', 
undef ],
+       outdir => [ "Output directory; where finished files are moved to.", 
'.', undef ],
        workdir => [ "Work directory; where unfinished files are stored.", '.', 
undef ],
 );
 

Modified: toys/rsget.pl/RSGet/Get.pm
==============================================================================
--- toys/rsget.pl/RSGet/Get.pm  (original)
+++ toys/rsget.pl/RSGet/Get.pm  Thu Oct  1 21:29:44 2009
@@ -8,7 +8,7 @@
 use URI;
 set_rev qq$Id$;
 def_settings(
-       errorlog => [ "Save errors", 0, qr/\d/ ],
+       errorlog => [ "Save errors.", 0, qr/\d/ ],
 );
 
 BEGIN {

Modified: toys/rsget.pl/RSGet/Line.pm
==============================================================================
--- toys/rsget.pl/RSGet/Line.pm (original)
+++ toys/rsget.pl/RSGet/Line.pm Thu Oct  1 21:29:44 2009
@@ -196,7 +196,7 @@
                update();
        };
 
-       local $SIG{__DIE__} = sub {
+       $SIG{__DIE__} = sub {
                print_all_lines();
                print "\n";
                print "DIED: ", shift, "\n\n";

Modified: toys/rsget.pl/RSGet/Main.pm
==============================================================================
--- toys/rsget.pl/RSGet/Main.pm (original)
+++ toys/rsget.pl/RSGet/Main.pm Thu Oct  1 21:29:44 2009
@@ -20,9 +20,9 @@
 set_rev qq$Id$;
 
 def_settings(
-       interfaces => [ "Specify output interfaces or IP addresses", undef, 
qr/\d+/ ],
-       http_port => [ "Start HTTP server on specified port.", 0, qr/\d+/ ],
-       verbose => [ "Verbosity level", 0, qr/\d+/ ],
+       interfaces => [ "Specify output interfaces or IP addresses.", undef, 
qr/\d+/ ],
+       http_port => [ "Start HTTP server on specified port.", undef, qr/\d+/ ],
+       verbose => [ "Verbosity level.", 0, qr/\d+/ ],
 );
 
 my $http = undef;
@@ -61,7 +61,34 @@
 {
        require Term::Size;
        my ( $columns, $rows ) = Term::Size::chars;
-       warn "No help yet\n";
+       print "Usage: $0 [OPTIONS] [LIST FILE]\n";
+       print "Downloads files from services like RapidShare.\n\n";
+       print "Arguments are always mandatory.\n";
+       $columns = 80 if $columns < 40;
+       my $optlen = 20;
+       my $textlen = $columns - $optlen - 1;
+       foreach my $s ( sort keys %main::def_settings ) {
+               my $option = "  --$s=VAL";
+               my $l = length $option;
+               if ( $l > $optlen ) {
+                       print $option . "\n" . " " x $optlen;
+               } else {
+                       print $option . " " x ( $optlen - $l );
+               }
+               my @text = split /\s+/, $main::def_settings{ $s }->[0];
+               my $defval = $main::def_settings{ $s }->[1];
+               push @text, "Default:", $defval if defined $defval;
+               my $line = "";
+               foreach my $word ( @text ) {
+                       if ( length( $word ) + length( $line ) > $textlen - 4 ) 
{
+                               print $line . "\n" . " " x ($optlen + 2);
+                               $line = "";
+                       }
+                       $line .= " " . $word;
+               }
+               print $line . "\n";
+       }
+       print "\n";
 
        exit 0;
 }
@@ -96,7 +123,7 @@
        return unless $port;
 
        require RSGet::HTTPServer;
-       $http = new RSGet::HTTPServer( setting("http_port") );
+       $http = new RSGet::HTTPServer( $port );
        if ( $http ) {
                p "HTTP server started on port $port";
        } else {

Modified: toys/rsget.pl/RSGet/Processor.pm
==============================================================================
--- toys/rsget.pl/RSGet/Processor.pm    (original)
+++ toys/rsget.pl/RSGet/Processor.pm    Thu Oct  1 21:29:44 2009
@@ -229,7 +229,12 @@
        pr @{$parts{perl}};
        pr "1;";
 
-       my $ret = eval $processed;
+       my $ret;
+       {
+               local $SIG{__DIE__};
+               delete $SIG{__DIE__};
+               $ret = eval $processed;
+       }
 
        if ( $@ ) {
                p "Error(s): $...@\n";

Modified: toys/rsget.pl/rsget.pl
==============================================================================
--- toys/rsget.pl/rsget.pl      (original)
+++ toys/rsget.pl/rsget.pl      Thu Oct  1 21:29:44 2009
@@ -25,7 +25,7 @@
 my @ifs;
 parse_args();
 
-if ( $settings{use_svn}->[0] =~ /^(yes|update)$/ and -d "$cdir/RSGet") {
+if ( $settings{use_svn}->[0] =~ /^(yes|update)$/ ) {
        $local_path = $cdir;
        unshift @INC, $local_path;
 
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to