Changeset 12613


Ignore:
Timestamp:
2006-08-30T15:49:44+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/classinfo.pl

    r12545 r12613  
    105105   
    106106    # If there is not exactly 1 argument left (classifier name), then the arguments were wrong
    107     # Or if the user specified -h, then we output the usage also
    108     if( $intArgLeftinAfterParsing != 1 || (@ARGV && $ARGV[0] =~ /^\-+h/) )
     107    # If the user specified -h, then we output the usage also
     108    if((@ARGV && $ARGV[0] =~ /^\-+h/) )
    109109    {
    110110    PrintUsage::print_txt_usage($options, "{classinfo.params}"); 
    111111        die "\n";
     112    }
     113
     114    # If there is not exactly 1 argument left (plugin name), then the arguments were wrong (apart from if we had listall or describeall set)
     115    if ($listall == 0 && $describeall ==0 && $intArgLeftinAfterParsing == 0) {
     116    gsprintf(STDERR, "{pluginfo.no_plugin_name}\n\n");
     117    PrintUsage::print_txt_usage($options, "{pluginfo.params}", 1);
     118    die "\n";
     119    }
     120   
     121    # we had some arguments that we weren't expecting
     122    if ($intArgLeftinAfterParsing > 1) {
     123    pop(@ARGV); # assume that the last arg is the plugin name
     124    gsprintf(STDERR, "{common.invalid_options}\n\n", join (',', @ARGV));
     125    PrintUsage::print_txt_usage($options, "{pluginfo.params}", 1);
     126    die "\n";
    112127    }
    113128
     
    116131    if (defined $classifier) {
    117132    $classifier =~ s/\.pm$//; # allow xxx.pm as the argument
    118     }
    119     if (($listall == 0 && $describeall == 0) && (!defined $classifier || $classifier eq "")) {
    120     &gsprintf(STDERR, "{classinfo.no_classifier_name}\n\n");
    121     &PrintUsage::print_txt_usage($options, "{classinfo.params}", 1);
    122     die "\n";
    123133    }
    124134
  • trunk/gsdl/bin/script/pluginfo.pl

    r12545 r12613  
    127127
    128128    # If there is not exactly 1 argument left (plugin name), then the arguments were wrong
    129     # Or if the user specified -h, then we output the usage also
    130     if( $unparsed_args != 1 || (@ARGV && $ARGV[0] =~ /^\-+h/) )
     129    # If the user specified -h, then we output the usage also
     130    if((@ARGV && $ARGV[0] =~ /^\-+h/) )
    131131    {
    132132    PrintUsage::print_txt_usage($options, "{pluginfo.params}"); 
    133133        die "\n";
    134134    }
    135    
     135
     136    # If there is not exactly 1 argument left (plugin name), then the arguments were wrong (apart from if we had listall or describeall set)
     137    if ($listall == 0 && $describeall ==0 && $unparsed_args == 0) {
     138    gsprintf(STDERR, "{pluginfo.no_plugin_name}\n\n");
     139    PrintUsage::print_txt_usage($options, "{pluginfo.params}", 1);
     140    die "\n";
     141    }
     142
     143    # we had some arguments that we weren't expecting
     144    if ($unparsed_args > 1) {
     145    pop(@ARGV); # assume that the last arg is the plugin name
     146    gsprintf(STDERR, "{common.invalid_options}\n\n", join (',', @ARGV));
     147    PrintUsage::print_txt_usage($options, "{pluginfo.params}", 1);
     148    die "\n";
     149    }
     150   
    136151    my $plugin = shift (@ARGV);
    137152    if (defined $plugin) {
    138153    $plugin =~ s/\.pm$//; # allow xxxPlug.pm as the argument
    139     }
    140     if (($listall == 0 && $describeall ==0) && (!defined $plugin || $plugin eq "")) {
    141     gsprintf(STDERR, "{pluginfo.no_plugin_name}\n\n");
    142     PrintUsage::print_txt_usage($options, "{pluginfo.params}", 1);
    143     die "\n";
    144154    }
    145155
Note: See TracChangeset for help on using the changeset viewer.