Changeset 10230
- Timestamp:
- 2005-07-08T11:08:25+12:00 (19 years ago)
- Location:
- trunk/gsdl/bin/script
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/bin/script/classinfo.pl
r7952 r10230 27 27 ########################################################################### 28 28 29 use strict; 30 no strict 'subs'; # allow barewords (eg STDERR) as function arguments 29 31 30 32 BEGIN { … … 38 40 use classify; 39 41 use util; 40 use parsargv;41 42 use gsprintf; 42 43 use printusage; 43 44 45 use parse2; 44 46 45 47 my $arguments = … … 47 49 'desc' => "{classinfo.collect}", 48 50 'type' => "string", 51 'deft' => "", 49 52 'reqd' => "no" }, 50 53 { 'name' => "xml", … … 70 73 } 71 74 72 73 # sub print_usage {74 # print STDERR "\n";75 # print STDERR "classinfo.pl: Prints information about a classifier.\n\n";76 # print STDERR " usage: $0 [options] classifier\n\n";77 # print STDERR " options:\n";78 # print STDERR " -collect collection-name Giving a collection name will make classinfo.pl\n";79 # print STDERR " look in collect/collection-name/perllib/classify\n";80 # print STDERR " first. If the classifier is not found there it will\n";81 # print STDERR " look in the general perllib/classify directory.\n\n";82 # print STDERR " -xml Produces the information in an xml form, without\n";83 # print STDERR " 'pretty' comments but with much more detail.\n\n";84 # print STDERR " -language language-code Language to display classifer options in (eg. 'en_US'\n";85 # print STDERR " specifies American English). Requires translations\n";86 # print STDERR " of the option descriptions to exist in the\n";87 # print STDERR " perllib/strings_language-code.rb file.\n";88 # }89 90 91 75 sub main { 92 76 my $collect = ""; 93 77 my $xml = 0; 94 78 my $listall = 0; 79 my $language; 95 80 96 # Parse command line 97 if (!parsargv::parse(\@ARGV, 98 q^collect/.*/^, \$collect, 99 q^xml^, \$xml, 100 q^listall^, \$listall, 101 q^language/.*/^, \$language)) 81 my $hashParsingResult = {}; 82 my $blnParseFailed = "false"; 83 # general options available to all plugins 84 my $intArgLeftinAfterParsing = parse2::parse(\@ARGV,$arguments,$hashParsingResult,"allow_extra_options"); 85 # If there are more than one argument left after parsing, it mean user input too many arguments. 86 # Error occoured will return 0 87 if($intArgLeftinAfterParsing > 1) 102 88 { 103 &PrintUsage::print_txt_usage($options, "{classinfo.params}" , 1);89 &PrintUsage::print_txt_usage($options, "{classinfo.params}"); 104 90 die "\n"; 105 91 } 106 92 93 foreach my $strVariable (keys %$hashParsingResult) 94 { 95 eval "\$$strVariable = \$hashParsingResult->{\"\$strVariable\"}"; 96 } 107 97 # If $language has been specified, load the appropriate resource bundle 108 98 # (Otherwise, the default resource bundle will be loaded automatically) … … 113 103 # Get classifier 114 104 my $classifier = shift (@ARGV); 105 $classifier =~ s/\.pm$//; # allow xxx.pm as the argument 106 115 107 if (($listall == 0) && (!defined $classifier || $classifier eq "")) { 116 108 &gsprintf(STDERR, "{classinfo.no_classifier_name}\n\n"); -
trunk/gsdl/bin/script/pluginfo.pl
r9375 r10230 41 41 use plugin; 42 42 use util; 43 use parsargv;44 43 use gsprintf; 45 44 use printusage; 46 45 46 use parse2; 47 47 48 48 my $arguments = … … 78 78 my $xml = 0; 79 79 my $listall = 0; 80 80 81 81 my ($language, $encoding); 82 82 83 if (!parsargv::parse(\@ARGV, 84 q^collect/.*/^, \$collect, 85 q^xml^, \$xml, 86 q^listall^, \$listall, 87 q^language/.*/^, \$language)) 83 my $hashParsingResult = {}; 84 my $blnParseFailed = "false"; 85 # general options available to all plugins 86 my $intArgLeftinAfterParsing = parse2::parse(\@ARGV,$arguments,$hashParsingResult,"allow_extra_options"); 87 # If there are more than one argument left after parsing, it mean user input too many arguments. 88 # Error occoured will return 0 89 if($intArgLeftinAfterParsing > 1) 88 90 { 89 PrintUsage::print_txt_usage($options, "{pluginfo.params}", 1);91 &PrintUsage::print_txt_usage($options, "{pluginfo.params}"); 90 92 die "\n"; 93 } 94 95 foreach my $strVariable (keys %$hashParsingResult) 96 { 97 eval "\$$strVariable = \$hashParsingResult->{\"\$strVariable\"}"; 91 98 } 92 99 … … 114 121 115 122 my $plugin = shift (@ARGV); 123 $plugin =~ s/\.pm$//; # allow xxxPlug.pm as the argument 124 116 125 if (($listall == 0) && (!defined $plugin || $plugin eq "")) { 117 126 gsprintf(STDERR, "{pluginfo.no_plugin_name}\n\n");
Note:
See TracChangeset
for help on using the changeset viewer.