Changeset 5606
- Timestamp:
- 2003-10-09T15:53:46+13:00 (21 years ago)
- Location:
- trunk/gsdl/bin/script
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/bin/script/buildcol.pl
r5097 r5606 42 42 use util; 43 43 use FileHandle; 44 use gsprintf; 44 45 use printusage; 45 46 … … 185 186 sub lookup_string 186 187 { 187 return & PrintUsage::lookup_string($language, shift(@_));188 return &gsprintf::lookup_string($language, shift(@_)); 188 189 } 189 190 … … 533 534 close CFGFILE; 534 535 } 535 -
trunk/gsdl/bin/script/classinfo.pl
r4873 r5606 38 38 use util; 39 39 use parsargv; 40 use gsprintf; 41 use printusage; 40 42 41 sub print_usage { 42 print STDERR "\n"; 43 print STDERR "classinfo.pl: Prints information about a classifier.\n\n"; 44 print STDERR " usage: $0 [options] classifier\n\n"; 45 print STDERR " options:\n"; 46 print STDERR " -collect collection-name Giving a collection name will make classinfo.pl\n"; 47 print STDERR " look in collect/collection-name/perllib/classify\n"; 48 print STDERR " first. If the classifier is not found there it will\n"; 49 print STDERR " look in the general 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\n"; 52 print STDERR " -language language-code Language to display plugin options in (eg. 'en_US'\n"; 53 print STDERR " specifies American English). Requires translations\n"; 54 print STDERR " of the option descriptions to exist in the\n"; 55 print STDERR " perllib/strings_language-code.rb file.\n"; 43 44 my $arguments = 45 [ { 'name' => "collect", 46 'desc' => "{classinfo.collect}", 47 'type' => "string", 48 'reqd' => "no" }, 49 { 'name' => "xml", 50 'desc' => "{scripts.xml}", 51 'type' => "flag", 52 'reqd' => "no" }, 53 { 'name' => "language", 54 'desc' => "{scripts.language}", 55 'type' => "string", 56 'reqd' => "no" } ]; 57 58 my $options = { 'name' => "classinfo.pl", 59 'desc' => "{classinfo.desc}", 60 'args' => $arguments }; 61 62 63 sub lookup_string 64 { 65 return &gsprintf::lookup_string($language, shift(@_)); 56 66 } 57 67 58 &main (); 68 69 sub print_txt_usage 70 { 71 local $language = shift(@_); 72 73 local $programname = $options->{'name'}; 74 local $programargs = $options->{'args'}; 75 76 # Find the length of the longest option string 77 local $descoffset = 0; 78 if (defined($programargs)) { 79 $descoffset = &PrintUsage::find_longest_option_string($programargs); 80 } 81 82 # Produce the usage information using the data structure above 83 print STDERR $programname . ": " . &lookup_string($options->{'desc'}) . "\n\n"; 84 print STDERR " " . &lookup_string("{common.usage}") . ": $programname"; 85 print STDERR " " . &lookup_string("{classinfo.params}") . "\n\n"; 86 87 # Display the program options, if there are some 88 if (defined($programargs)) { 89 # Calculate the column offset of the option descriptions 90 local $optiondescoffset = $descoffset + 2; # 2 spaces between options & descriptions 91 92 print STDERR " " . &lookup_string("{common.options}") . ":\n"; 93 94 # Display the program options 95 &PrintUsage::print_options_txt($language, $programargs, $optiondescoffset); 96 } 97 } 98 99 100 # sub print_usage { 101 # print STDERR "\n"; 102 # print STDERR "classinfo.pl: Prints information about a classifier.\n\n"; 103 # print STDERR " usage: $0 [options] classifier\n\n"; 104 # print STDERR " options:\n"; 105 # print STDERR " -collect collection-name Giving a collection name will make classinfo.pl\n"; 106 # print STDERR " look in collect/collection-name/perllib/classify\n"; 107 # print STDERR " first. If the classifier is not found there it will\n"; 108 # print STDERR " look in the general perllib/classify directory.\n\n"; 109 # print STDERR " -xml Produces the information in an xml form, without\n"; 110 # print STDERR " 'pretty' comments but with much more detail.\n\n"; 111 # print STDERR " -language language-code Language to display classifer options in (eg. 'en_US'\n"; 112 # print STDERR " specifies American English). Requires translations\n"; 113 # print STDERR " of the option descriptions to exist in the\n"; 114 # print STDERR " perllib/strings_language-code.rb file.\n"; 115 # } 116 59 117 60 118 sub main { … … 69 127 q^language/.*/^, \$language)) 70 128 { 71 &print_ usage();129 &print_txt_usage($language); 72 130 die "\n"; 73 131 } … … 76 134 my $classifier = shift (@ARGV); 77 135 if (!defined $classifier || $classifier eq "") { 78 print STDERR "You must provide a classifier name\n";79 &print_ usage();136 print STDERR &lookup_string("{classinfo.no_classifier_name}") . "\n\n"; 137 &print_txt_usage($language); 80 138 die "\n"; 81 139 } … … 95 153 } 96 154 else { 97 print STDERR " 98 $classifier info: 99 100 Options may be passed to any classifier by including them in your collect.cfg 101 configuration file. 102 103 Classifiers may take two types of options: 104 105 "; 106 print STDERR "Specific options are defined within the classifier itself, and are available\n"; 107 print STDERR "only to this particular classifier.\n\n"; 108 109 print STDERR "General options are inherited from parent classes of the classifer.\n\n"; 155 print STDERR "\n$classifier " . &lookup_string("{classinfo.info}") . ":\n\n"; 156 print STDERR &lookup_string("{classinfo.passing_options}") . "\n\n"; 157 print STDERR &lookup_string("{classinfo.option_types}") . ":\n\n"; 158 print STDERR &lookup_string("{classinfo.specific_options}") . "\n\n"; 159 print STDERR &lookup_string("{classinfo.general_options}") . "\n\n"; 110 160 111 161 $classobj->print_txt_usage($language); … … 114 164 115 165 116 117 166 &main (); -
trunk/gsdl/bin/script/import.pl
r5097 r5606 46 46 use parsargv; 47 47 use FileHandle; 48 use gsprintf; 48 49 use printusage; 49 50 … … 183 184 sub lookup_string 184 185 { 185 return & PrintUsage::lookup_string($language, shift(@_));186 return &gsprintf::lookup_string($language, shift(@_)); 186 187 } 187 188 -
trunk/gsdl/bin/script/mkcol.pl
r5092 r5606 42 42 use util; 43 43 use cfgread; 44 use gsprintf; 44 45 use printusage; 45 46 … … 143 144 sub lookup_string 144 145 { 145 return & PrintUsage::lookup_string($language, shift(@_));146 return &gsprintf::lookup_string($language, shift(@_)); 146 147 } 147 148 -
trunk/gsdl/bin/script/pluginfo.pl
r4873 r5606 40 40 use util; 41 41 use parsargv; 42 use gsprintf; 43 use printusage; 42 44 43 sub 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 " first. If the plugin is not found there it will\n"; 51 print STDERR " look in the general perllib/plugins directory.\n\n"; 52 print STDERR " -xml Produces the information in an xml form, without\n"; 53 print STDERR " 'pretty' comments but with much more detail.\n\n"; 54 print STDERR " -language language-code Language to display plugin options in (eg. 'en_US'\n"; 55 print STDERR " specifies American English). Requires translations\n"; 56 print STDERR " of the option descriptions to exist in the\n"; 57 print STDERR " perllib/strings_language-code.rb file.\n"; 45 46 my $arguments = 47 [ { 'name' => "collect", 48 'desc' => "{pluginfo.collect}", 49 'type' => "string", 50 'reqd' => "no" }, 51 { 'name' => "xml", 52 'desc' => "{scripts.xml}", 53 'type' => "flag", 54 'reqd' => "no" }, 55 { 'name' => "language", 56 'desc' => "{scripts.language}", 57 'type' => "string", 58 'reqd' => "no" } ]; 59 60 my $options = { 'name' => "pluginfo.pl", 61 'desc' => "{pluginfo.desc}", 62 'args' => $arguments }; 63 64 65 sub lookup_string 66 { 67 return &gsprintf::lookup_string($language, shift(@_)); 58 68 } 59 69 60 70 61 &main (); 71 sub print_txt_usage 72 { 73 local $language = shift(@_); 74 75 local $programname = $options->{'name'}; 76 local $programargs = $options->{'args'}; 77 78 # Find the length of the longest option string 79 local $descoffset = 0; 80 if (defined($programargs)) { 81 $descoffset = &PrintUsage::find_longest_option_string($programargs); 82 } 83 84 # Produce the usage information using the data structure above 85 print STDERR $programname . ": " . &lookup_string($options->{'desc'}) . "\n\n"; 86 print STDERR " " . &lookup_string("{common.usage}") . ": $programname"; 87 print STDERR " " . &lookup_string("{pluginfo.params}") . "\n\n"; 88 89 # Display the program options, if there are some 90 if (defined($programargs)) { 91 # Calculate the column offset of the option descriptions 92 local $optiondescoffset = $descoffset + 2; # 2 spaces between options & descriptions 93 94 print STDERR " " . &lookup_string("{common.options}") . ":\n"; 95 96 # Display the program options 97 &PrintUsage::print_options_txt($language, $programargs, $optiondescoffset); 98 } 99 } 100 101 102 # sub print_usage { 103 # print STDERR "\n"; 104 # print STDERR "pluginfo.pl: Prints information about a plugin.\n\n"; 105 # print STDERR " usage: $0 [options] plugin\n\n"; 106 # print STDERR " options:\n"; 107 # print STDERR " -collect collection-name Giving a collection name will make pluginfo.pl\n"; 108 # print STDERR " look in collect/collection-name/perllib/plugins\n"; 109 # print STDERR " first. If the plugin is not found there it will\n"; 110 # print STDERR " look in the general perllib/plugins directory.\n\n"; 111 # print STDERR " -xml Produces the information in an xml form, without\n"; 112 # print STDERR " 'pretty' comments but with much more detail.\n\n"; 113 # print STDERR " -language language-code Language to display plugin options in (eg. 'en_US'\n"; 114 # print STDERR " specifies American English). Requires translations\n"; 115 # print STDERR " of the option descriptions to exist in the\n"; 116 # print STDERR " perllib/strings_language-code.rb file.\n"; 117 # } 62 118 63 119 sub main { … … 71 127 q^language/.*/^, \$language)) 72 128 { 73 &print_ usage();129 &print_txt_usage($language); 74 130 die "\n"; 75 131 } … … 77 133 my $plugin = shift (@ARGV); 78 134 if (!defined $plugin || $plugin eq "") { 79 print STDERR "You must provide a plugin name\n";80 &print_ usage();135 print STDERR &lookup_string("{pluginfo.no_plugin_name}") . "\n\n"; 136 &print_txt_usage($language); 81 137 die "\n"; 82 138 } … … 95 151 } 96 152 else { 97 print STDERR "\n$plugin info:\n\n"; 98 99 print STDERR "Options may be passed to any plugin by including them in your collect.cfg\n"; 100 print STDERR "configuration file.\n\n"; 101 102 print STDERR "Plugins may take two types of options:\n\n"; 103 104 print STDERR "Specific options are defined within the plugin itself, and are available\n"; 105 print STDERR "only to this particular plugin.\n\n"; 106 107 print STDERR "General options are inherited from parent classes of the plugin.\n\n"; 153 print STDERR "\n$plugin " . &lookup_string("{pluginfo.info}") . ":\n\n"; 154 print STDERR &lookup_string("{pluginfo.passing_options}") . "\n\n"; 155 print STDERR &lookup_string("{pluginfo.option_types}") . ":\n\n"; 156 print STDERR &lookup_string("{pluginfo.specific_options}") . "\n\n"; 157 print STDERR &lookup_string("{pluginfo.general_options}") . "\n\n"; 108 158 109 159 $plugobj->print_txt_usage($language); … … 117 167 } 118 168 169 170 &main ();
Note:
See TracChangeset
for help on using the changeset viewer.