Ignore:
Timestamp:
2006-08-31T14:08:40+12:00 (18 years ago)
Author:
mdewsnip
Message:

Merged the "-listall" and "-describeall" code, and made both always produce XML. The format of the XML has changed slightly too.

File:
1 edited

Legend:

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

    r12625 r12629  
    160160    }
    161161
    162     if ($listall) {
    163     my $plugin_dir = &util::filename_cat($ENV{'GSDLCOLLECTDIR'},"perllib","plugins");
     162    if ($listall || $describeall) {
     163    my $plugin_dir = &util::filename_cat($ENV{'GSDLCOLLECTDIR'}, "perllib", "plugins");
    164164    if (!opendir (INDIR, $plugin_dir)) {
    165165        print STDERR "pluginfo.pl: could not open directory $plugin_dir\n";
     
    169169        closedir (INDIR);
    170170
    171         if ($xml) {
    172         my $num_plugins = scalar(@plugin_list);
    173 
    174         print STDERR "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
    175         print STDERR "<PluginList length=\"$num_plugins\">\n";
    176         map { print STDERR "  <PluginName>$_</PluginName>\n"; } @plugin_list;
    177         print STDERR "</PluginList>\n";
     171        print STDERR "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
     172        print STDERR "<PluginList length=\"" . scalar(@plugin_list) . "\">\n";
     173        foreach my $plugin (@plugin_list) {
     174        $plugin =~ s/\.pm$//;
     175        my $plugobj = &plugin::load_plugin_for_info ($plugin);
     176        if ($describeall) {
     177            $plugobj->print_xml_usage(0);
     178        }
     179        else {
     180            $plugobj->print_xml_usage(0, 1);
     181        }
    178182        }
    179         else {
    180         print STDERR join(" ",@plugin_list), "\n";
    181         }
    182     }
    183     }
    184     elsif ($describeall) {
    185     my $plugin_dir = &util::filename_cat($ENV{'GSDLCOLLECTDIR'},"perllib","plugins");
    186     my @plugin_list;
    187     if (!opendir (INDIR, $plugin_dir)) {
    188         print STDERR "pluginfo.pl: could not open directory $plugin_dir\n";
    189     }
    190     else {
    191         @plugin_list = grep (/Plug\.pm$/, readdir (INDIR));
    192         closedir (INDIR);
    193     }
    194     #sort (@plugin_list);
    195     if ($xml) {
    196         my $num_plugin = scalar(@plugin_list);
    197         &PrintUsage::print_xml_header("plugin", 1);
    198         print STDERR "<PlugInfoList length=\"$num_plugin\">\n";
    199     }
    200     foreach my $pl (@plugin_list) {
    201         $pl =~ s/\.pm$//;
    202         &print_single_plugin($pl, $xml, 0);
    203     }
    204     if ($xml) {
    205         print STDERR "</PlugInfoList>\n";
     183        print STDERR "</PluginList>\n";
    206184    }
    207185    }
     
    210188    }
    211189}
     190
    212191
    213192sub print_single_plugin {
Note: See TracChangeset for help on using the changeset viewer.