From ae5cd1f7885c063aeede9c508c702b3440dbd47d Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 28 May 2010 18:56:24 +0200 Subject: comirror-setup: Document options, use batch mode when not connected to a terminal --- bin/comirror-setup | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/bin/comirror-setup b/bin/comirror-setup index 879c32c..d554473 100755 --- a/bin/comirror-setup +++ b/bin/comirror-setup @@ -11,7 +11,8 @@ my @images; my @unique_images; my ($image_re, $cache) = (q{}) x 2; my $length; -my ($conf, $state); +my $conf = {}; +my $state; my @opts = ( [ 'batch', @@ -63,7 +64,11 @@ sub parse_or_ask_options { return; } -GetOptions(\%{$conf}, map { $_->[0] . $_->[1] } @opts); +GetOptions($conf, map { $_->[0] . $_->[1] } @opts); + +if (not -t STDOUT) { + $conf->{'batch'} = 1; +} if (@ARGV != 3 ) { die("Need three URLs to compare (first, second, last but one)\n"); @@ -173,9 +178,25 @@ figure out the text on the "next" link. It then creates F and F so that you only need to call comirror(1) to start downloading. +Unless all options (or B<--batch>) were specified on the commandline, +B will interactively ask the user for further options. + =head1 OPTIONS -B takes no options yet. +=over + +=item B<--batch> + +Do not ask questions interactively. Take default values or those specified +via options on the commandline. + +=item B<--link-to-image> I + +First try downloading a link matching image_re, and if that fails look for an +image matching image_re. Note that this does not (yet) affect image_re +detection. + +=back =head1 EXIT STATUS -- cgit v1.2.3