Changeset 4749


Ignore:
Timestamp:
2003-06-23T11:50:45+12:00 (21 years ago)
Author:
mdewsnip
Message:

First cut at changing pluginfo to use the data structures added to each plugin containing a description of their parameters. Pluginfo now shows options all the way up the plugin hierarchy (not just the plugin and BasPlug). The code for generating the usage text from the data structures is in BasPlug.pm.

File:
1 edited

Legend:

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

    r3541 r4749  
    5151    print STDERR "                             it will look in the general perllib/plugins\n";
    5252    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";
     53    print STDERR "   -xml                      Produces the information in an xml form, without\n";
     54    print STDERR "                             'pretty' comments but with much more detail.\n";
    5555}
    5656
     
    6060sub main {
    6161    my $collect = "";
    62     my $xml = 0;
     62    my $xml = 0;
    6363
    6464    if (!parsargv::parse(\@ARGV, q^collect/.*/^, \$collect, q^xml^, \$xml ))
    65     {
    66           &print_usage();
    67           die "\n";
    68     }
     65    {
     66    &print_usage();
     67    die "\n";
     68    }
    6969
    7070    my $plugin = shift (@ARGV);
    7171    if (!defined $plugin || $plugin eq "") {
    72           print STDERR "You must provide a plugin name\n";
    73           &print_usage();
    74           die "\n";
     72    print STDERR "You must provide a plugin name\n";
     73    &print_usage();
     74    die "\n";
    7575    }
    7676
    7777    if ($collect ne "") {
    78           $ENV{'GSDLCOLLECTDIR'} = &util::filename_cat ($ENV{'GSDLHOME'}, "collect", $collect);
     78    $ENV{'GSDLCOLLECTDIR'} = &util::filename_cat ($ENV{'GSDLHOME'}, "collect", $collect);
    7979    } else {
    80           $ENV{'GSDLCOLLECTDIR'} = $ENV{'GSDLHOME'};
     80    $ENV{'GSDLCOLLECTDIR'} = $ENV{'GSDLHOME'};
    8181    }
    8282
    83     my $pluginfo = &plugin::load_plugins ([[$plugin]]);
     83    my $pluginfo = &plugin::load_plugins ([[$plugin]]);
    8484     
    85     my $plugobj = shift @$pluginfo;
     85    my $plugobj = shift @$pluginfo;
    8686
    87     if ($xml) {     
     87    if ($xml) { 
    8888        $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";
     89    }
     90    else {
     91    my $pluginfo = &plugin::load_plugins ([[$plugin]]);
    10592
    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      }
     93    my $plugobj = shift @$pluginfo;
     94
     95    print STDERR "\n$plugin info:\n\n";
     96
     97    print STDERR "Options may be passed to any plugin by including them in your collect.cfg\n";
     98    print STDERR "configuration file.\n\n";
     99
     100    print STDERR "Plugins may take two types of options:\n\n";
     101
     102    print STDERR "Specific options are defined within the plugin itself, and are available\n";
     103    print STDERR "only to this particular plugin.\n\n";
     104
     105    print STDERR "General options are inherited from parent classes of the plugin.\n\n";
     106#   print STDERR "General options are defined within the base class (BasPlug.pm) and are\n";
     107#   print STDERR "inherited by any plugin that has been correctly derived from BasPlug.\n\n";
     108
     109#   print STDERR "$plugin takes the following specific options:\n";
     110    # $plugobj->print_usage();
     111    $plugobj->new_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: ";
     117#   print STDERR "\"" . $plugobj->get_default_process_exp() . "\"\n\n";
     118
     119#   print STDERR " The default block_exp for $plugin is: ";
     120#   print STDERR "\"" . $plugobj->get_default_block_exp() . "\"\n\n";
     121    }
    122122}
    123123
Note: See TracChangeset for help on using the changeset viewer.