source: tags/gsdl-2_40-distribution/gsdl/bin/script/pluginfo.pl@ 4846

Last change on this file since 4846 was 4779, checked in by mdewsnip, 21 years ago

Tidied up the code for displaying usage text.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 KB
Line 
1#!/usr/bin/perl -w
2
3###########################################################################
4#
5# pluginfo.pl --
6# A component of the Greenstone digital library software
7# from the New Zealand Digital Library Project at the
8# University of Waikato, New Zealand.
9#
10# Copyright (C) 1999 New Zealand Digital Library Project
11#
12# This program is free software; you can redistribute it and/or modify
13# it under the terms of the GNU General Public License as published by
14# the Free Software Foundation; either version 2 of the License, or
15# (at your option) any later version.
16#
17# This program is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20# GNU General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, write to the Free Software
24# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25#
26###########################################################################
27
28# This program will print info about a plugin
29
30# @revision 09/05/02 Added XML usage information flag - John Thompson
31
32BEGIN {
33 die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
34 die "GSDLOS not set\n" unless defined $ENV{'GSDLOS'};
35 unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
36 unshift (@INC, "$ENV{'GSDLHOME'}/perllib/plugins");
37}
38
39use plugin;
40use util;
41use parsargv;
42
43sub print_usage {
44 print STDERR "\n";
45 print STDERR "pluginfo.pl: Prints information about a plugin.\n\n";
46 print STDERR " usage: $0 [options] plugin\n\n";
47 print STDERR " options:\n";
48 print STDERR " -collect collection-name Giving a collection name will make pluginfo.pl\n";
49 print STDERR " look in collect/collection-name/perllib/plugins\n";
50 print STDERR " for plugin first. If it doesn't find it there\n";
51 print STDERR " it will look in the general perllib/plugins\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";
55}
56
57
58&main ();
59
60sub main {
61 my $collect = "";
62 my $xml = 0;
63
64 if (!parsargv::parse(\@ARGV, q^collect/.*/^, \$collect, q^xml^, \$xml ))
65 {
66 &print_usage();
67 die "\n";
68 }
69
70 my $plugin = shift (@ARGV);
71 if (!defined $plugin || $plugin eq "") {
72 print STDERR "You must provide a plugin name\n";
73 &print_usage();
74 die "\n";
75 }
76
77 if ($collect ne "") {
78 $ENV{'GSDLCOLLECTDIR'} = &util::filename_cat ($ENV{'GSDLHOME'}, "collect", $collect);
79 } else {
80 $ENV{'GSDLCOLLECTDIR'} = $ENV{'GSDLHOME'};
81 }
82
83 my $pluginfo = &plugin::load_plugins ([[$plugin]]);
84
85 my $plugobj = shift @$pluginfo;
86
87 if ($xml) {
88 $plugobj->print_xml_usage();
89 }
90 else {
91 my $pluginfo = &plugin::load_plugins ([[$plugin]]);
92
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
107 $plugobj->print_txt_usage();
108
109# print STDERR " The default process_exp for $plugin is: ";
110# print STDERR "\"" . $plugobj->get_default_process_exp() . "\"\n\n";
111
112# print STDERR " The default block_exp for $plugin is: ";
113# print STDERR "\"" . $plugobj->get_default_block_exp() . "\"\n\n";
114 }
115}
116
Note: See TracBrowser for help on using the repository browser.