Changeset 629

Show
Ignore:
Timestamp:
04/08/07 19:26:45 (6 years ago)
Author:
lincoln
Message:

allow setting of command line options as per #43

Files:
2 modified

Legend:

Unmodified
Added
Removed
  • applications/shepherd

    r625 r629  
    22 
    33my $progname = 'shepherd'; 
    4 my $version = '0.4.85'; 
     4my $version = '0.4.86'; 
    55 
    66# tv_grab_au 
     
    165165# --------------------------------------------------------------------------- 
    166166 
    167 &get_command_line_options; 
     167&get_command_line_options(1); 
    168168 
    169169&capabilities if ($opt->{capabilities}); 
     
    185185 
    186186&process_setup_commands; 
     187&get_command_line_options(0) if (defined $components->{$progname}->{default_cmdline}); 
    187188 
    188189&open_logfile unless ($opt->{nolog} or $opt->{update} or $opt->{configure}); 
     
    13771378sub get_command_line_options 
    13781379{ 
    1379   # Record so we can pass the unmodified args to components later 
    1380   @options = @ARGV;     # Record so we can pass the unmodified args to components later 
    1381   push (@options,"") if ($#options == -1); # silence warnings if none 
    1382  
    1383   # filter what options we don't pass on .. 
    1384   foreach (0..$#options) { 
    1385     next if (!$options[$_]); 
    1386  
    1387     splice(@options,$_,2) if ($options[$_] =~ /^--config-file/);        # don't pass on "--config-file (file)" 
    1388     splice(@options,$_,1) if ($options[$_] =~ /^--quiet/);              # never be quiet 
     1380  my $use_argv = shift; 
     1381 
     1382  if ($use_argv) { 
     1383    # Record so we can pass the unmodified args to components later 
     1384    @options = @ARGV;   # Record so we can pass the unmodified args to components later 
     1385    push (@options,"") if ($#options == -1); # silence warnings if none 
     1386 
     1387    # filter what options we don't pass on .. 
     1388    foreach (0..$#options) { 
     1389        next if (!$options[$_]); 
     1390 
     1391        splice(@options,$_,2) if ($options[$_] =~ /^--config-file/);    # don't pass on "--config-file (file)" 
     1392        splice(@options,$_,1) if ($options[$_] =~ /^--quiet/);          # never be quiet 
     1393    } 
     1394  } else { 
     1395    push(@ARGV,split(/:/,$components->{$progname}->{default_cmdline})); 
    13891396  } 
    13901397 
     
    14011408                        description 
    14021409                        quiet 
     1410                        notquiet 
    14031411                        version 
    14041412                        debug 
     
    14301438  $debug = $opt->{debug}; 
    14311439  $days = $opt->{days} if ($opt->{days}); 
     1440  delete $opt->{quiet} if (defined $opt->{notquiet}); 
    14321441} 
    14331442 
     
    15451554    } 
    15461555    my $arg = join(":",@args); 
     1556 
     1557    if ($component eq $progname) { 
     1558        if ((!defined $arg) || ($arg eq "")) { 
     1559            delete $components->{$progname}->{default_cmdline}; 
     1560            &log("\ncleared default options for $progname\n"); 
     1561        } else { 
     1562            $components->{$progname}->{default_cmdline} = "--".join(":--",@args); 
     1563            &log("\nset default options for $progname to: ".$components->{$progname}->{default_cmdline}."\n"); 
     1564        } 
     1565        write_config_file(); 
     1566        return; 
     1567    } 
     1568 
    15471569    if ((!defined $arg) || ($arg eq "")) { 
    15481570        &log("\nNothing to set: you need to use this as --component-set (component):(settings)\n"); 
     
    21952217    --debug               Print lots of debugging messages 
    21962218    --quiet               Don't print anything except errors 
     2219    --notquiet            Override any previous --quiet 
    21972220    --nolog               Don't write a logfile 
    21982221 
  • status

    r628 r629  
    1 application     shepherd            0.4.85 
     1application     shepherd            0.4.86 
    22grabber         yahoo7widget        1.82 
    33grabber         rex                 3.4.7