ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/ActiveDoc/CommandLineInterface.pm
(Generate patch)

Comparing COMP/SCRAM/src/ActiveDoc/CommandLineInterface.pm (file contents):
Revision 1.3 by williamc, Mon Sep 20 16:27:57 1999 UTC vs.
Revision 1.4 by williamc, Thu Dec 16 16:01:32 1999 UTC

# Line 4 | Line 4
4   # Originally Written by Christopher Williams
5   #
6   # Description
7 < # Do all the setting up required for the UserQuery based on an input hash
7 > # Do all the setting up required for the Query based on an input hash
8   # --- defaults taken from activedoc configuration setup
9   #
10   # Interface
# Line 30 | Line 30
30   # - private interface -------------------------------
31   # getoptions(command, level)    : return the optionhash for a given command
32   # parsecmdoptions(optionhashref, \@args) : parse the options, setting the
33 < #                                       UserQuery
33 > #                                       Query
34   #                                      appropriately as indicated by optionhash
35   #                                      The option hash ref should have the
36   #                                       format as given in example below
# Line 41 | Line 41
41   #
42  
43   package ActiveDoc::CommandLineInterface;
44 < use ActiveDoc::UserQuery;
45 < use ActiveDoc::DOChandler;
44 > use ActiveDoc::Query;
45 > use ActiveDoc::StarterDoc;
46 > use ActiveDoc::UserInterface_basic;
47 > #use ActiveDoc::DOChandler;
48   require 5.001;
49  
50   sub new {
# Line 61 | Line 63 | sub init {
63  
64          # Set up a User Query Object
65          $self->{UI}=$UI;
66 <        $self->{UserQuery}=ActiveDoc::UserQuery->new($self->{UI});
65 <        $self->_defaults(); # set up some minimal defaults
66 >        $self->{Query}=ActiveDoc::Query->new();
67  
68          # Set up our command handling object
69          eval "require $file" ;
# Line 76 | Line 77 | sub parse {
77          my $self=shift;
78          my @args=@_;
79  
80 <        # Get all parameters into UserQuery
80 >        # Get all parameters into Query
81          $self->parseoptions(@_);
82  
83          # Initialise the DocHandler with what weve got so  far
84 <        $self->{dochandler}=ActiveDoc::DOChandler->new($self->{UserQuery});
84 >        #$self->{dochandler}=ActiveDoc::DOChandler->new($self->{Query});
85 >        $self->{StartDoc}=ActiveDoc::StarterDoc->new($self->{Query},
86 >                                        $self->{UI} );
87  
88          $self->{Commands}->parse(@_);
89  
# Line 115 | Line 118 | sub parsecmdoptions {
118             else {
119                  # take next word as argument -- indicate by >
120                  if ( $$optionhashref{$option}[1]=~/^\>\>/ ) {
121 <                   $self->{UserQuery}->setparam($$optionhashref{$option}[0],
121 >                   $self->{Query}->setparam($$optionhashref{$option}[0],
122                          (shift @$argref));
123                  }
124                  else { # simply set value as in hashref
125 <                   $self->{UserQuery}->setparam($$optionhashref{$option}[0],
125 >                   $self->{Query}->setparam($$optionhashref{$option}[0],
126                                          $$optionhashref{$option}[1]);
127                  }
128             }
# Line 155 | Line 158 | sub parseoptions {
158          while ( ( $#args >= 0) && ( $level <= $#{$self->{commands}}) ) {
159            $arg=shift @args;
160            if ( exists ${$self->{commands}[$level]}{$arg} ) {
161 <                $self->{UserQuery}->setparam("_cmd_$level", $arg);
161 >                $self->{Query}->setparam("_cmd_$level", $arg);
162                  $commandhashref=$self->getoptions($arg, $level);
163                  $self->parsecmdoptions($commandhashref, \@args);
164                  $self->{arglev}=$level;
# Line 221 | Line 224 | sub command {
224          my $self=shift;
225          my $level=shift;
226  
227 <        return $self->{UserQuery}->getparam("_cmd_$level");
225 < }
226 <
227 < #
228 < # Minimum defaults for a simple Dochandler Bootstrap
229 < #
230 < sub _defaults {
231 <        my $self=shift;
232 <        $self->{UserQuery}->setparam('cache', "/tmp");
227 >        return $self->{Query}->getparam("_cmd_$level");
228   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines