Changeset 3541


Ignore:
Timestamp:
2002-11-18T17:44:39+13:00 (21 years ago)
Author:
kjdon
Message:

added John T's changes into CVS - classinfo.pl and pluginfo.pl can now give back info in xml

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

Legend:

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

    r2785 r3541  
    4848    print STDERR "         first. If it doesn't find it there it will look in the general\n";
    4949    print STDERR "         perllib/classify directory.\n\n";
     50     print STDERR "   -xml                      Produces the information in an xml form, without\n";
     51     print STDERR "                             'pretty' comments but with much more detail.\n";
    5052}
    5153
     
    5456sub main {
    5557    my $collect = "";
     58     my $xml = 0;
    5659
    5760    # Parse command line
    58     if (!parsargv::parse(\@ARGV, 'collect.*/', \$collect)) {
    59     &print_usage();
    60     die "\n";
     61    if (!parsargv::parse(\@ARGV, q^collect/.*/^, \$collect, q^xml^, \$xml ))
     62     {
     63          &print_usage();
     64          die "\n";
    6165    }
    6266
     
    6468    my $classifier = shift (@ARGV);
    6569    if (!defined $classifier || $classifier eq "") {
    66     print STDERR "You must provide a classifier name\n";
    67     &print_usage();
    68     die "\n";
     70          print STDERR "You must provide a classifier name\n";
     71          &print_usage();
     72          die "\n";
    6973    }
    7074
    7175    # make sure the classifier is loaded from the correct location - a hack.
    7276    if ($collect ne "") {
    73     $ENV{'GSDLCOLLECTDIR'} = &util::filename_cat ($ENV{'GSDLHOME'}, "collect", $collect);
     77          $ENV{'GSDLCOLLECTDIR'} = &util::filename_cat ($ENV{'GSDLHOME'}, "collect", $collect);
    7478    } else {
    75     $ENV{'GSDLCOLLECTDIR'} = $ENV{'GSDLHOME'};
     79          $ENV{'GSDLCOLLECTDIR'} = $ENV{'GSDLHOME'};
    7680    }
    77 
     81     
    7882    my $classinfo = &classify::load_classifiers ([[$classifier]]);
    7983    my $classobj = shift @$classinfo;
    8084
    81     print STDERR "
     85    if ($xml)
     86    {
     87        $classobj->print_xml_usage();
     88     }
     89     else
     90     {
     91          print STDERR "
    8292$classifier info:
    8393
     
    95105$classifier takes the following specific options:
    96106";
    97     $classobj->print_usage();
     107          $classobj->print_usage();
    98108
    99     print STDERR "$classifier takes the following general options
     109          print STDERR "$classifier takes the following general options
    100110";
    101     &BasClas::print_general_usage($classifier);
    102 
     111          &BasClas::print_general_usage($classifier);
     112     }
    103113}
    104114
  • trunk/gsdl/bin/script/pluginfo.pl

    r2785 r3541  
    2626###########################################################################
    2727
     28# This program will print info about a plugin
    2829
    29 # This program will print info about a plugin
     30# @revision 09/05/02 Added XML usage information flag - John Thompson
    3031
    3132BEGIN {
     
    4950    print STDERR "                             for plugin first. If it doesn't find it there\n";
    5051    print STDERR "                             it will look in the general perllib/plugins\n";
    51     print STDERR "                             directory\n\n";
     52    print STDERR "                             directory\n";
     53     print STDERR "   -xml                      Produces the information in an xml form, without\n";
     54     print STDERR "                             'pretty' comments but with much more detail.\n";
    5255}
    5356
     
    5760sub main {
    5861    my $collect = "";
    59     if (!parsargv::parse(\@ARGV, 'collect.*/', \$collect)) {
    60     &print_usage();
    61     die "\n";
    62     }
     62     my $xml = 0;
     63
     64    if (!parsargv::parse(\@ARGV, q^collect/.*/^, \$collect, q^xml^, \$xml ))
     65     {
     66          &print_usage();
     67          die "\n";
     68     }
    6369
    6470    my $plugin = shift (@ARGV);
    6571    if (!defined $plugin || $plugin eq "") {
    66     print STDERR "You must provide a plugin name\n";
    67     &print_usage();
    68     die "\n";
     72          print STDERR "You must provide a plugin name\n";
     73          &print_usage();
     74          die "\n";
    6975    }
    7076
    7177    if ($collect ne "") {
    72     $ENV{'GSDLCOLLECTDIR'} = &util::filename_cat ($ENV{'GSDLHOME'}, "collect", $collect);
     78          $ENV{'GSDLCOLLECTDIR'} = &util::filename_cat ($ENV{'GSDLHOME'}, "collect", $collect);
    7379    } else {
    74     $ENV{'GSDLCOLLECTDIR'} = $ENV{'GSDLHOME'};
     80          $ENV{'GSDLCOLLECTDIR'} = $ENV{'GSDLHOME'};
    7581    }
    7682
    77     my $pluginfo = &plugin::load_plugins ([[$plugin]]);
     83     my $pluginfo = &plugin::load_plugins ([[$plugin]]);
     84     
     85     my $plugobj = shift @$pluginfo;
    7886
    79     my $plugobj = shift @$pluginfo;
     87     if ($xml) {     
     88        $plugobj->print_xml_usage();
     89     }
     90     else
     91     {
     92          my $pluginfo = &plugin::load_plugins ([[$plugin]]);
     93     
     94          my $plugobj = shift @$pluginfo;
     95     
     96          print STDERR "\n$plugin info:\n\n";
     97   
     98          print STDERR "Options may be passed to any plugin by including them in your collect.cfg\n";
     99          print STDERR "configuration file.\n\n";
     100         
     101          print STDERR "Plugins may take two types of options:\n\n";
     102         
     103          print STDERR "General options are defined within the base class (BasPlug.pm) and are\n";
     104          print STDERR "inherited by any plugin that has been correctly derived from BasPlug.\n\n";
    80105
    81     print STDERR "\n$plugin info:\n\n";
    82    
    83     print STDERR "Options may be passed to any plugin by including them in your collect.cfg\n";
    84     print STDERR "configuration file.\n\n";
    85 
    86     print STDERR "Plugins may take two types of options:\n\n";
    87 
    88     print STDERR "General options are defined within the base class (BasPlug.pm) and are\n";
    89     print STDERR "inherited by any plugin that has been correctly derived from BasPlug.\n\n";
    90 
    91     print STDERR "Specific options are defined within the plugin itself and are available\n";
    92     print STDERR "only to this particular plugin.\n\n";
    93 
    94     print STDERR "$plugin takes the following specific options:\n";
    95     $plugobj->print_usage();
    96 
    97     print STDERR "$plugin takes the following general options\n";
    98     &BasPlug::print_general_usage($plugin);
    99 
    100     print STDERR "The default process_exp for $plugin is\n";
    101     print STDERR "\"" . $plugobj->get_default_process_exp() . "\"\n\n";
    102 
    103     print STDERR "The default block_exp for $plugin is\n";
    104     print STDERR "\"" . $plugobj->get_default_block_exp() . "\"\n\n";
    105 
     106          print STDERR "Specific options are defined within the plugin itself and are available\n";
     107          print STDERR "only to this particular plugin.\n\n";
     108         
     109          print STDERR "$plugin takes the following specific options:\n";
     110         
     111          $plugobj->print_usage();
     112         
     113          print STDERR "$plugin takes the following general options\n";
     114          &BasPlug::print_general_usage($plugin);
     115         
     116          print STDERR "The default process_exp for $plugin is\n";
     117          print STDERR "\"" . $plugobj->get_default_process_exp() . "\"\n\n";
     118         
     119          print STDERR "The default block_exp for $plugin is\n";
     120          print STDERR "\"" . $plugobj->get_default_block_exp() . "\"\n\n";
     121     }
    106122}
    107123
Note: See TracChangeset for help on using the changeset viewer.