Changeset 12615


Ignore:
Timestamp:
2006-08-30T16:00:35+12:00 (18 years ago)
Author:
kjdon
Message:

changed slightly the checking of how many args we have left after parsing. we need to allow listall and describeall without a plugin name

Location:
trunk/gsdl/bin/script
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/bin/script/downloadinfo.pl

    r12545 r12615  
    8888    # parse returns -1 on error
    8989    if ($unparsed_args == -1) {
    90     PrintUsage::print_txt_usage($options, "{pluginfo.params}");
     90    PrintUsage::print_txt_usage($options, "{downloadinfo.params}");
    9191    die "\n";
    9292    }
     
    127127    # Or if the user specified -h, then we output the usage also
    128128
    129     if( $unparsed_args != 1 || (@ARGV && $ARGV[0] =~ /^\-+h/) )
     129    if((@ARGV && $ARGV[0] =~ /^\-+h/) )
    130130    {
    131131    PrintUsage::print_txt_usage($options, "{downloadinfo.params}");
     
    133133    }
    134134   
     135    # If there is not exactly 1 argument left (download name), then the arguments were wrong (apart from if we had listall or describeall set)
     136    if ($listall == 0 && $describeall ==0 && $unparsed_args == 0) {
     137    gsprintf(STDERR, "{downloadinfo.no_download_name}\n\n");
     138    PrintUsage::print_txt_usage($options, "{downloadinfo.params}", 1);
     139    die "\n";
     140    }
     141
     142    # we had some arguments that we weren't expecting
     143    if ($unparsed_args > 1) {
     144    pop(@ARGV); # assume that the last arg is the download name
     145    gsprintf(STDERR, "{common.invalid_options}\n\n", join (',', @ARGV));
     146    PrintUsage::print_txt_usage($options, "{downloadinfo.params}", 1);
     147    die "\n";
     148    }
    135149    my $download_name = shift (@ARGV);
    136150    if (defined $download_name) {
    137151    $download_name =~ s/\.pm$//; # allow xxx.pm as the argument
    138     }
    139     if (($listall == 0 && $describeall ==0) && (!defined $download_name || $download_name eq "")) {
    140     gsprintf(STDERR, "{downloadinfo.no_download_name}\n\n");
    141     PrintUsage::print_txt_usage($options, "{downloadinfo.params}", 1);
    142     die "\n";
    143152    }
    144153
  • trunk/gsdl/bin/script/plugoutinfo.pl

    r12545 r12615  
    130130    # If there is not exactly 1 argument left (plugout name), then the arguments were wrong
    131131    # Or if the user specified -h, then we output the usage also
    132     if( $unparsed_args != 1 || (@ARGV && $ARGV[0] =~ /^\-+h/) )
     132    if(@ARGV && $ARGV[0] =~ /^\-+h/ )
    133133    {
    134134    PrintUsage::print_txt_usage($options, "{plugoutinfo.params}"); 
     
    136136    }
    137137
     138    # If there is not exactly 1 argument left (plugout name), then the arguments were wrong (apart from if we had listall or describeall set)
     139    if ($listall == 0 && $describeall ==0 && $unparsed_args == 0) {
     140    gsprintf(STDERR, "{plugoutinfo.no_plugout_name}\n\n");
     141    PrintUsage::print_txt_usage($options, "{plugoutinfo.params}", 1);
     142    die "\n";
     143    }
     144
     145    # we had some arguments that we weren't expecting
     146    if ($unparsed_args > 1) {
     147    pop(@ARGV); # assume that the last arg is the plugout name
     148    gsprintf(STDERR, "{common.invalid_options}\n\n", join (',', @ARGV));
     149    PrintUsage::print_txt_usage($options, "{plugoutinfo.params}", 1);
     150    die "\n";
     151    }
     152
    138153    my $plugout = shift (@ARGV);
    139154    if (defined $plugout) {
    140155    $plugout =~ s/\.pm$//; # allow xxxPlugout.pm as the argument
    141     }
    142     if (($listall == 0 && $describeall ==0) && (!defined $plugout || $plugout eq "")) {
    143     gsprintf(STDERR, "{plugoutinfo.no_plugout_name}\n\n");
    144     PrintUsage::print_txt_usage($options, "{plugoutinfo.params}", 1);
    145     die "\n";
    146156    }
    147157
Note: See TracChangeset for help on using the changeset viewer.