#!/usr/bin/perl # URLToys Command Line use strict; use WWW::URLToys qw/:DEFAULT ut_command_loop loadconfig :configvars/; use Getopt::Std; # The variables getopts needs to set our ($opt_d,$opt_h); # The variables we use from URLToys' :configvars our($config_file,$config_downloaddir); my @utlist; getopts('dh'); if($opt_h) { print "urltoys usage: urltoys [options] [url] -d : Defaults. Do not load config file. -h : This screen. You can always do a 'pod2html urltoys' to really understand it!\n"; exit; }; # Using -d will skip the loadconfig call, leaving defaults if($opt_d) { print "Using defaults. Use \"config save\" now to make it permanent.\n"; } else { loadconfig($config_file); } if($config_downloaddir) { chdir $config_downloaddir; } # Allow one URL passed via command line if(@ARGV > 0) { my $initial_command = join ' ',@ARGV; ut_exec_command($initial_command,\@utlist); }; $SIG{'INT'} = 'ut_stop_download'; # Begin Main Loop ut_command_loop(*STDIN,\@utlist);