Changeset 4762


Ignore:
Timestamp:
2003-06-23T14:31:57+12:00 (21 years ago)
Author:
mdewsnip
Message:

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

File:
1 edited

Legend:

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

    r3541 r4762  
    4848    print STDERR "         first. If it doesn't find it there it will look in the general\n";
    4949    print STDERR "         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";
     50    print STDERR "   -xml                      Produces the information in an xml form, without\n";
     51    print STDERR "                             'pretty' comments but with much more detail.\n";
    5252}
    5353
     
    5656sub main {
    5757    my $collect = "";
    58     my $xml = 0;
     58    my $xml = 0;
    5959
    6060    # Parse command line
    6161    if (!parsargv::parse(\@ARGV, q^collect/.*/^, \$collect, q^xml^, \$xml ))
    62     {
    63           &print_usage();
    64           die "\n";
     62    {
     63    &print_usage();
     64    die "\n";
    6565    }
    6666
     
    6868    my $classifier = shift (@ARGV);
    6969    if (!defined $classifier || $classifier eq "") {
    70           print STDERR "You must provide a classifier name\n";
    71           &print_usage();
    72           die "\n";
     70    print STDERR "You must provide a classifier name\n";
     71    &print_usage();
     72    die "\n";
    7373    }
    7474
    7575    # make sure the classifier is loaded from the correct location - a hack.
    7676    if ($collect ne "") {
    77           $ENV{'GSDLCOLLECTDIR'} = &util::filename_cat ($ENV{'GSDLHOME'}, "collect", $collect);
     77    $ENV{'GSDLCOLLECTDIR'} = &util::filename_cat ($ENV{'GSDLHOME'}, "collect", $collect);
    7878    } else {
    79           $ENV{'GSDLCOLLECTDIR'} = $ENV{'GSDLHOME'};
     79    $ENV{'GSDLCOLLECTDIR'} = $ENV{'GSDLHOME'};
    8080    }
    81    
     81
    8282    my $classinfo = &classify::load_classifiers ([[$classifier]]);
    8383    my $classobj = shift @$classinfo;
     
    8686    {
    8787        $classobj->print_xml_usage();
    88     }
    89     else
    90     {
    91           print STDERR "
     88    }
     89    else
     90    {
     91    print STDERR "
    9292$classifier info:
    9393
     
    9797Classifiers may take two types of options:
    9898
    99 General options are defined within the base class (BasClas.pm) and are
    100 inherited by any classifier that has been correctly derived from BasClas.
     99";
     100    print STDERR "Specific options are defined within the classifier itself, and are available\n";
     101    print STDERR "only to this particular classifier.\n\n";
    101102
    102 Specific options are defined within the classifier itself and are available
    103 only to this particular classifier.
     103    print STDERR "General options are inherited from parent classes of the classifer.\n\n";
    104104
    105 $classifier takes the following specific options:
    106 ";
    107           $classobj->print_usage();
     105# General options are defined within the base class (BasClas.pm) and are
     106# inherited by any classifier that has been correctly derived from BasClas.
    108107
    109           print STDERR "$classifier takes the following general options
    110 ";
    111           &BasClas::print_general_usage($classifier);
    112      }
     108# Specific options are defined within the classifier itself and are available
     109# only to this particular classifier.
     110
     111# $classifier takes the following specific options:
     112# ";
     113    # $classobj->print_usage();
     114    $classobj->new_print_usage();
     115
     116#   print STDERR "$classifier takes the following general options
     117# ";
     118#   &BasClas::print_general_usage($classifier);
     119    }
    113120}
    114121
Note: See TracChangeset for help on using the changeset viewer.