ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/scram
Revision: 1.29
Committed: Tue Feb 22 16:13:00 2000 UTC (25 years, 2 months ago) by williamc
Branch: MAIN
Changes since 1.28: +276 -171 lines
Log Message:
Generalise command processing - multi level commands and aut help calling

File Contents

# User Rev Content
1 williamc 1.29 #!/usr/local/bin/perl5 -w
2 williamc 1.1 #
3     # User Interface
4     #
5    
6 williamc 1.28 # Make sure were running the right version
7 williamc 1.29 #versioncheck();
8 williamc 1.28
9     $bold = "\033[1m";
10     $normal = "\033[0m";
11 williamc 1.29 @allowed_commands=qw(area project tool options install list arch version setup runtime db devtest doctest);
12 williamc 1.28
13     use Scram::SCRAM2;
14     setupscram();
15 williamc 1.29
16     $found=_processcmds("_mainoptions",\@allowed_commands,\@ARGV);
17 williamc 1.28
18     if ( ! ( $found=~/true/ ) ) {
19     helpheader('Recognised Commands');
20     foreach $command ( @allowed_commands ) {
21     print " $bold scram ".$command.$normal."\n";
22     }
23     print "\n";
24     print "Help on individual commands available through\n\n";
25     print "$bold scram".$normal." command$bold help $normal\n\n";
26 williamc 1.29 print "Main options can be seen with\n";
27     print "$bold scram options help$normal\n\n";
28     }
29    
30     sub options {
31     help_options();
32     }
33    
34     # --------- main command processing routines
35    
36     sub _mainoptions {
37     my $option=shift;
38     my $cmds=shift;
39    
40     if ( $option eq "-f" ) {
41     # force update of urls
42     shift @$cmds;
43     $scram->setoption("url_update", 1);
44     }
45     elsif ( $option eq "-update" ) {
46     # force update of urls
47     shift @$cmds;
48     $scram->setoption("url_update", shift @ARGV);
49     }
50     elsif ( $option eq "-arch" ) {
51     # pretend to be a different architecture
52     shift @$cmds;
53     my $arch=$scram->arch();
54     $arch->arch(shift @$cmds);
55     }
56     elsif ( $option eq "-verbose" ) {
57     shift @$cmds;
58     $scram->setoption("verbose_".$$cmds[0],1);
59     print "Verbose turned on for $$cmds[0]\n";
60     shift @$cmds;
61     }
62     else {
63     $scram->error("Unknown Option $option");
64     }
65     }
66    
67     sub _processcmds {
68     my $optionhandler=shift;
69     my $allowed_commands=shift;
70     my $cmds=shift;
71     my @subs=@_;
72    
73     my $found='false';
74     # make a string from the subcommand levels
75     my $substring="";
76     if ( @subs ) {
77     $substring= join '_', @subs;
78     $substring=$substring."_";
79     }
80    
81     # Process options
82     while ( ${$cmds}[0]=~/^-/) {
83     &{$optionhandler}( ${$cmds}[0],$cmds);
84     }
85    
86     my $inputcmd=shift @{$cmds};
87     if ( $inputcmd ne "" ) {
88     foreach $command ( @{$allowed_commands} ) {
89     if ( $command=~/^$inputcmd/i) {
90     # Deal with a help request
91     if ( ( defined $$cmds[0]) && $$cmds[0]=~/help/i ) {
92     &helpheader($command,@subs);
93     &{"help_".$substring.$command}; exit;
94     }
95     else {
96     #print "calling $substring".$command."(@{$cmds})\n";
97     &{$substring.$command}(@{$cmds}); $found='true';
98     last;
99     }
100     }
101     }
102     }
103     return $found;
104     }
105    
106     sub help_options {
107     helpheader('Main SCRAM options');
108     print "$bold -arch ".$normal."architecture \n";
109     print "\tPretend to be the specified architecture\n\n";
110     print "$bold -f $normal \n";
111     print "\tForced update of urls instead of using"
112     ." the cached\n\tversions\n\n";
113     print "$bold -re $normal\n";
114     print "\tRequest Exit - Scram will ask the user to enter RETURN\n".
115     "\tat the end of the process rather than exiting directly\n";
116     print "\tUseful for use where scram is run as a forked process\n\n";
117     print "$bold -update ".$normal."string \n";
118     print "\tAs -f but only update the url that matches the \n";
119     print "\tgiven string\n\n";
120     print "$bold -verbose ".$normal."object \n";
121     print "\tTurn on the verbose mode for the specified object.\n";
122     print "\tThe special object \"all\" will turn on verbosity for\n";
123     print "\tall objects that support verbosity\n\n";
124 williamc 1.28 }
125    
126     sub versioncheck {
127     my $version;
128     my $thisversion;
129    
130     $thisversion=getversion();
131    
132     if ( ! localtop_find() ) {
133     LoadEnvFile();
134     my $versionfile=$ENV{LOCALTOP}."/$ENV{projconfigdir}/scram_version";
135     if ( -f $versionfile ) {
136     open (VERSION, "<".$versionfile) ;
137     $version=<VERSION>;
138     chomp $version;
139     if ( $version ne $thisversion ) {
140     # first try to use the correct version
141     if ( -d $scram_top."/".$version ) {
142     $ENV{SCRAM_HOME}=$scram_top."/".$version;
143     system("scram", @ARGV);
144     exit;
145     }
146     else { # if not then simply warn
147     print "******* Warning : scram version inconsistent ********\n";
148     print "This version: $thisversion; Required version: $version";
149     print "*****************************************************\n";
150     print "\n";
151     }
152     }
153     }
154     }
155     }
156    
157     sub doctest {
158     $scram->doctest(@ARGV);
159     }
160    
161     sub help_build {
162     &build;
163     }
164     sub build {
165     # is this a based or free release?
166     FullEnvInit();
167     use BuildSetup;
168     $ENV{MAKETARGETS}=join ' ',@ARGV;
169     BuildSetup($ENV{THISDIR},@ARGV);
170     }
171    
172     sub project {
173     # process options
174     while ( $ARGV[0]=~"^-" ) {
175     if ( $ARGV[0]=~/-n/ ) {
176     shift @ARGV;
177 williamc 1.29 $self->setoptions("ConfigArea_name",shift @ARGV);
178 williamc 1.28 }
179     elsif ( $ARGV[0]=~/-d/ ) { #installation area directory
180     shift @ARGV;
181 williamc 1.29 $self->setoptions("ConfigArea_location",shift @ARGV);
182 williamc 1.28 }
183     else {
184     print "scram: unknown option $ARGV[0] to project command\n";
185     exit;
186     }
187     }
188 williamc 1.29
189     # -- work out if we have a url or not
190     if ( $ARGV[0]=~/.*:.*/ ) {
191     $scram->project(@ARGV);
192     }
193     else {
194     $scram->basedarea(@ARGV);
195     }
196     print "\nInstallation Procedure Complete. \n".
197 williamc 1.28 "Installation Located at:\n".cwd()."\n";
198     }
199    
200     sub runtime {
201     my $shell;
202     FullEnvInit();
203    
204     # process options
205     while ( $ARGV[0]=~"^-" ) {
206     if ( $ARGV[0]=~/-sh/ ) {
207     shift @ARGV;
208     $shell="sh";
209     next;
210     }
211     if ( $ARGV[0]=~/-csh/ ) { #installation area directory
212     shift @ARGV;
213     $shell="csh";
214     next;
215     }
216     print "Unknown Option $ARGV[0]\n";
217     exit 1;
218     }
219 williamc 1.29 print "Not yet implemented\n";
220 williamc 1.28 }
221    
222     # Support rt for runtime
223    
224     sub printoutenv {
225     my $shell=shift;
226     my $variable=shift;
227     my $value=shift;
228    
229     if ( $shell eq "csh" ) {
230     print "setenv $variable \"$value\";\n";
231     }
232     elsif ( $shell eq "sh" ) {
233     print "$variable=\"$value\";\n";
234     print "export $variable;\n";
235     }
236     }
237    
238     sub addpath {
239     my $name=shift;
240     my $val=shift;
241    
242     my $n;
243     my @env;
244     @env=split /:/, $EnvRuntime{$name};
245     foreach $n ( (split /:/, $val ) ){
246     if ( ! grep /^\Q$n\E$/, @env ) {
247     addvar($name,$n,":");
248     }
249     }
250     }
251    
252     sub addvar {
253     my $name=shift;
254     my $val=shift;
255     my $sep=shift;
256    
257     if ( $val ne "" ) {
258     if ( defined $EnvRuntime{$name} ) {
259     $EnvRuntime{$name}=$EnvRuntime{$name}.$sep.$val;
260     }
261     else {
262     $EnvRuntime{$name}=$val;
263     }
264     }
265     }
266    
267     sub FullEnvInit {
268     environmentinit();
269     localtop();
270     LoadEnvFile();
271     }
272    
273     sub environmentinit {
274 williamc 1.29 # use Utilities::setarchitecture;
275 williamc 1.28 my $name;
276     my $value;
277    
278     $ENV{LatestBuildFile}=""; # stop recursive behaviour in make
279 williamc 1.29 # setarchitecture::setarch();
280 williamc 1.28 $ENV{INTwork}="tmp/$ENV{SCRAM_ARCH}";
281     $ENV{INTlib}="lib/$ENV{SCRAM_ARCH}";
282     $ENV{INTsrc}="src";
283     $ENV{INTbin}="bin/$ENV{SCRAM_ARCH}";
284     $ENV{INTlog}="logs";
285    
286     ($ENV{SCRAM_BASEDIR}=$ENV{SCRAM_HOME})=~s/(.*)\/.*/$1/;
287     if ( ! ( exists $ENV{SCRAM_CONFIG} ) ){
288     $ENV{SCRAM_CONFIG}="$ENV{SCRAM_HOME}/configuration";
289     }
290     if ( ! ( exists $ENV{TOOL_HOME} ) ){
291     $ENV{TOOL_HOME}="$ENV{SCRAM_HOME}/src";
292     }
293     if ( ! ( exists $ENV{SCRAM_LOOKUPDB} ) ){
294     if ( -d "$ENV{SCRAM_BASEDIR}/scramdb/" ) {
295     $ENV{SCRAM_LOOKUPDB}="$ENV{SCRAM_BASEDIR}/scramdb/project.lookup";
296     }
297     else {
298     $ENV{SCRAM_LOOKUPDB}="$ENV{SCRAM_CONFIG}/project.lookup";
299     }
300     }
301     $ENV{SCRAM_AVAILDIRS}="";
302     $ENV{SCRAM_AVAILFILES}="";
303     }
304    
305     sub localtop_find {
306     # find localtop
307     use Cwd;
308     my $thispath=cwd;
309     my $rv=1;
310    
311     block: {
312     do {
313     if ( -e "$thispath/.SCRAM" ) {
314     $ENV{LOCALTOP}=$thispath;
315     $ENV{SCRAM_WORKDIR}="$ENV{LOCALTOP}/.SCRAM";
316     $rv=0;
317     last block;
318     }
319     } while ( ( $thispath=~s/(.*)\/.*/$1/ )=~/./ );
320     } #end block
321     return $rv;
322     }
323    
324     sub localtop {
325     localtop_find();
326     if ( ! (defined $ENV{LOCALTOP}) ) {
327     print "Unable to locate the top of local release. Exiting\n";
328     exit 1;
329     }
330     ($ENV{THISDIR}=cwd)=~s/^\Q$ENV{LOCALTOP}\L//;
331     $ENV{THISDIR}=~s/^\///;
332     }
333    
334     sub LoadEnvFile {
335     open ( SCRAMENV, "<$ENV{SCRAM_WORKDIR}/Environment" ) ||
336     die "Cant find Environment file $!\n";
337     while ( <SCRAMENV> ) {
338     chomp;
339     next if /^#/;
340     next if /^\s*$/ ;
341     ($name, $value)=split /=/;
342     eval "\$ENV{${name}}=\"$value\"";
343     }
344     close SCRAMENV;
345     }
346    
347     sub env {
348     print "Sorry - Not yet\n";
349     }
350    
351     #
352     # Create a lookup tag in the site database
353     #
354 williamc 1.29 sub install {
355 williamc 1.28 my $tagname=shift @ARGV;
356     my $version=shift @ARGV;
357 williamc 1.29 $scram->install();
358 williamc 1.28 }
359    
360 williamc 1.29 sub uninstall {
361     $scram->uninstall(@ARGV);
362 williamc 1.28 }
363    
364     sub help_install() {
365    
366     print <<ENDTEXT;
367     Associates a label with the current release in the SCRAM database.
368     This allows other users to refer to a centrally installed project by
369     this label rather than a remote url reference.
370    
371     Usage:
372    
373     $bold scram install $normal [project_tag [version_tag]]
374    
375     porject_tag : override default label (the project name of the current release)
376     version_tag : the version tag of the current release. If version is not
377     specified the base release version will be taken by default.
378    
379     ENDTEXT
380     exit;
381     }
382    
383    
384     sub getversion {
385     ($thisversion=$ENV{SCRAM_HOME})=~s/(.*)\///;
386     $scram_top=$1;
387     $scram_version=$thisversion;
388     # deal with links
389     my $version=readlink $ENV{SCRAM_HOME};
390     if ( defined $version) {
391     $scram_version=$version;
392     }
393     return $scram_version;
394     }
395    
396     sub version {
397     my $version=shift @ARGV;
398     my $thisversion;
399     my $scram_top;
400     my $cvsobject;
401    
402     ($thisversion=$ENV{SCRAM_HOME})=~s/(.*)\///;
403     $scram_top=$1;
404     if ( $version eq "" ) {
405     print "$thisversion";
406     # deal with links
407     $version=readlink $ENV{SCRAM_HOME};
408     if ( defined $version) {
409     print " ---> $version";
410     }
411     print "\n";
412     }
413     else {
414     if ( -d $scram_top."/".$version ) {
415     print "Version $version exists\n";
416     }
417     else {
418     print "Version $version not available locally\n";
419     print "Attempting download from the SCRAM repository\n";
420     # set up and configure the cvs module for SCRAM
421     use Utilities::CVSmodule;
422 williamc 1.29 $cvsobject=CVSmodule->new();
423 williamc 1.28 $cvsobject->set_base(
424     "cmscvs.cern.ch:/cvs_server/repositories/SCRAM");
425     $cvsobject->set_auth("pserver");
426     $cvsobject->set_user("anonymous");
427     $cvsobject->set_passkey("AA_:yZZ3e");
428     # Now check it out in the right place
429     chdir $scram_top or die "Unable to change to $scram_top $!\n";
430     $cvsobject->invokecvs( ( split / /,
431     "co -d $version -r $version SCRAM" ));
432    
433     # Get rid of cvs object now weve finished
434     $cvsobject=undef;
435     print "\n";
436     }
437     }
438     }
439    
440     sub list {
441     print "Installed Projects\n";
442     print "------------------\n";
443     print "|Project Name | Project Version |\n";
444     print "----------------------------------\n";
445 williamc 1.29 # listdb($filename);
446     my @areas=$scram->listprojects();
447     foreach $area ( @areas ) {
448     print $area->name()."\t".$area->version()."\n";
449     print "\t-->".$area->location()."\n";
450     }
451     }
452    
453     sub area {
454     my $subcmd=shift @ARGV;
455    
456     switch : {
457     if ( $subcmd eq 'link' ) {
458     $scram->link(@ARGV);
459     last switch;
460     }
461     elsif ( $subcmd eq 'unlink' ) {
462     $scram->unlink();
463     last switch;
464     }
465     elsif ( $subcmd eq 'install' ) {
466     install();
467     }
468     elsif ( $subcmd eq 'uninstall' ) {
469     uninstall();
470     }
471     }
472 williamc 1.28 }
473    
474     sub db {
475     my $subcmd=shift @ARGV;
476     &environmentinit;
477    
478     switch : {
479     if ( $subcmd eq 'link' ) {
480     dblink($ENV{SCRAM_LOOKUPDB},@ARGV);
481     last switch;
482     }
483     if ( $subcmd eq 'unlink' ) {
484     dbunlink($ENV{SCRAM_LOOKUPDB},@ARGV);
485     last switch;
486     }
487     if ( $subcmd eq 'showlinks' ) {
488     dblinklist($ENV{SCRAM_LOOKUPDB});
489     last switch;
490     }
491     } # end switch
492    
493     }
494    
495     sub dblinklist {
496     my $filename=shift;
497     open (LOCALLOOKUPDB, "<$filename") or
498     die "Unable to open local database $!";
499     while (<LOCALLOOKUPDB>) {
500     if ( $_=~/\!DB (.*)/) {
501     print $1,"\n";
502     }
503     }
504     close LOCALLOOKUPDB;
505     }
506    
507     sub dblink {
508     my $filename=shift;
509     my $newdbfilename=shift;
510     my $exists=0;
511    
512     if ( -e $filename ) {
513     if ( -e $newdbfilename ) {
514     # Check if its already there
515     open (LOCALLOOKUPDB, "<$filename") or
516     die "Unable to open local database $!";
517     while (<LOCALLOOKUPDB>) {
518     if ( $_=~/\!DB $newdbfilename/ ) {
519     $exists=1;
520     last;
521     }
522     }
523     close LOCALLOOKUPDB;
524     # Add it
525     if ( ! $exists ) {
526     open (LOCALLOOKUPDB, ">>$filename") or
527     die "Unable to open local database $!";
528     print LOCALLOOKUPDB "\!DB $newdbfilename\n";
529     close LOCALLOOKUPDB;
530     }
531     }
532     else {
533     print "Unknown file $newdbfilename\n";
534     exit();
535     }
536     }
537     else {
538     print "Unknown file $filename $!\n";
539     exit();
540     }
541    
542     }
543    
544     sub dbunlink {
545     my $filename=shift;
546     my $dbfilename=shift;
547     if ( -e $filename ) {
548     # Check if its already there
549     open (LOCALLOOKUPDB, "<$filename") or
550     die "Unable to open local database $!";
551     open (DBOUTFILE, ">$filename.tmp") or
552     die "Unable to open working file $!";
553     while (<LOCALLOOKUPDB>) {
554     if ( $_!~/\!DB $dbfilename/ ) {
555     print DBOUTFILE $_;
556     }
557     }
558     close LOCALLOOKUPDB;
559     close DBOUTFILE;
560     use File::Copy;
561     rename "$filename.tmp", $filename;
562     }
563     }
564    
565     sub listdb {
566     my $filename=shift;
567     my $map;
568    
569     use FileHandle;
570     my $fh=FileHandle->new();
571     open ( $fh, "<$filename" );
572     while ( $map=<$fh> ) {
573     if ( $map=~/^\!DB (.*)/ ) { # Check for other DB files
574     my $db=$1;
575     if ( -f $db ) {
576     listdb($db);
577     }
578     next;
579     }
580     ( $name, $version, $type, $url ) = split ":", $map;
581     printf "%1s",$name;
582     printf "%25s\n",$version;
583     printf "--> %25s\n",$type.":".$url;
584     }
585     close $fh;
586     }
587    
588     sub arch {
589 williamc 1.29 print $scram->arch()->arch()."\n";
590 williamc 1.28 }
591    
592     sub setupscram {
593     $scram=Scram::SCRAM2->new();
594     }
595    
596 williamc 1.29 # ------------ tool command --------------------------------------------
597     sub tool {
598     my @allowed_cmds=qw(setup info list);
599     _processcmds("_tooloptions", \@allowed_cmds, \@_, ("tool"));
600     }
601    
602     sub tool_setup {
603     my $tool=shift;
604    
605     print "Setting Up Tool $tool\n";
606     $scram->setuptool($tool,@_);
607     }
608    
609     sub tool_list {
610     my ($area,@tools)=$scram->tools();
611     print "Tool List for ".$area->name()." ".$area->version()."\n";
612     print "Location : ".$area->location()."\n";
613     print "+"x60;
614     print "\n";
615    
616     foreach $t ( @tools ) {
617     print $t->name();
618     print " ";
619     print $t->version();
620     print "\n";
621     }
622     }
623    
624     sub tool_info {
625     my $tool=shift;
626     print "Info on Tool $tool\n";
627     }
628    
629     sub _tooloptions {
630     $scram->error("No Options defined for tool command");
631     }
632    
633     sub help_tool_setup {
634     print <<ENDTEXT;
635     Description:
636     Set up the configuration parameters for a given tool
637     Usage :
638     scram tool setup tool_name [tool_version]
639    
640     ENDTEXT
641     }
642    
643     sub help_tool_info {
644     print <<ENDTEXT;
645     Description:
646     Print out information on the specified tool in the current area
647     configuration.
648     Usage :
649     scram tool info tool_name [tool_version]
650    
651     ENDTEXT
652     }
653    
654     sub help_tool_list {
655     print <<ENDTEXT;
656     Description:
657     List of currently configured tools available in ther current scram
658     area
659     Usage :
660     scram tool list
661    
662     ENDTEXT
663     }
664 williamc 1.28
665 williamc 1.29 # ----------- setup command ------------------------------------------
666 williamc 1.28 sub setup {
667     my $toolname=shift @ARGV;
668    
669     if ( ! defined $toolname ) {
670     # general area setup for new platform
671 williamc 1.29 print "****** Not implemented *****\n";
672 williamc 1.28 }
673     else {
674     $scram->setuptool($toolname);
675     }
676    
677     }
678    
679     sub devtest {
680     use Utilities::TestClass;
681     my $class=shift @ARGV;
682    
683     $scram->devtest($class);
684     }
685    
686 williamc 1.29 # ------------------- HELP routines ----------------------------------
687    
688 williamc 1.28
689     sub help_db {
690     print <<ENDTEXT;
691     scram database administration command.
692    
693     Usage:
694    
695     $bold scram db $normal subcommand
696    
697     subcommands:
698     link :
699     Make available an additional database for
700     project and list operations
701    
702     $bold scram db link $normal /a/directory/path/project.lookup
703    
704     unlink :
705     Remove a database from the link list. Note this does
706     not remove the database, just the link to it in scram.
707    
708     $bold scram db unlink $normal /a/directory/path/project.lookup
709    
710     showlinks :
711     List the databases that are linked in
712    
713     ENDTEXT
714     }
715    
716     sub help_setup {
717    
718     print <<ENDTEXT;
719     Allows installation/re-installation of a new tool/external package into an
720     already existing development area. If not toolname is specified,
721     the complete installation process is initiated.
722    
723     Usage:
724    
725     $bold scram setup $normal [toolname]
726    
727     toolname : The name of the tool setup file required.
728     ENDTEXT
729     exit;
730     }
731    
732 williamc 1.29 sub help_area {
733     print <<ENDTEXT;
734     Provides access to Scram development area management tools
735    
736     Usage:
737    
738     $bold scram area $normal [link|unlink|install|uninstall] options
739    
740     Description of subcommnads:
741    
742     ${bold}scram area link ${normal}project_tag version_tag
743     Attatch the scram area corresponding to the current working directory
744     to the named project and version in the central installation
745     (see scram list)
746    
747     ${bold}scram area unlink $normal
748     Break a link with the central installation
749    
750     ${bold}scram area install ${normal}[project_tag [version_tag]]
751     Create an entry for the current area in the central installation database
752     (admin permissions required)
753    
754     ${bold}scram area uninstall ${normal}[project_tag [version_tag]]
755     Delete entry for the current area in the central installation database
756     (admin permissions required)
757    
758     ENDTEXT
759     exit;
760     }
761    
762 williamc 1.28 sub help_list {
763     print <<ENDTEXT;
764     List the available projects and versions installed in the local SCRAM database
765     (see scram install help)
766    
767     Usage:
768    
769     $bold scram list $normal
770    
771     ENDTEXT
772     exit;
773     }
774    
775     sub help_project {
776     print <<ENDTEXT;
777     Setup a new project development area. The new area will appear in the current
778     working directory.
779     Usage:
780    
781     $bold scram project [-d install_area] [-n directory_name]$normal project_url [project_version]
782    
783     Options:
784    
785     project_url: The url of a scram bootstrap file.
786     Currently supported types are:
787     $bold Database label $normal
788     Labels can be assigned to bootstrap files for easy
789     access (See "scram install" command). If you
790     specify a label you must also specify a project_version.
791     e.g.
792    
793     scram project SCRAM V1_0
794    
795     scram project ORCA ORCA_1_1_1
796    
797     To see the list of installed projects use the
798     "scram list" command.
799    
800     $bold file: $normal A regular file on an accessable file system
801     e.g.
802    
803     file:~/myprojects/projecta/config/BootStrapFile
804    
805     project_version:
806     Only for use with a database label
807    
808     -d install_area:
809     Indicate a project installation area into which the new
810     project area should appear. Default is the current working
811     directory.
812    
813     -n directory_name:
814     Specify the name of the SCRAM development area you wish to
815     create.
816    
817     ENDTEXT
818     }
819    
820     sub help_version {
821     print <<ENDTEXT;
822     With now $bold[version] $normal argument given, this command will simply
823     print to standard output the current version number.
824    
825     Providing a version argument will cause that version to be downloaded and
826     installed, if not already locally available.
827     [Coming soon: When available locally, your current development area will
828     then be associated with the specified scram version rather than the default]
829    
830    
831     Usage:
832     $bold scram version [version]$normal
833    
834     ENDTEXT
835     }
836    
837     sub help_arch {
838     print <<ENDTEXT;
839     Print out the architecture flag for the current machine.
840    
841     Usage:
842     $bold scram arch $normal
843     ENDTEXT
844     }
845    
846 williamc 1.29 sub help_tool {
847     print <<ENDTEXT;
848     Manage the tools in the scram area that define the areas environment.
849     ENDTEXT
850     }
851    
852 williamc 1.28 sub help_runtime {
853     print <<ENDTEXT;
854     Echo to Standard Output the Runtime Environment for the current development area
855     Output available in csh or sh flavours
856    
857     Usage:
858     $bold scram runtime [-csh|-sh] $normal
859    
860     Examples:
861    
862     Setup the current environment to include the project Runtime Environment
863     in a csh environment
864    
865     $bold eval `scram runtime -csh` $normal
866    
867     Setup the current environment to include the project Runtime Environment in a
868     sh environment
869    
870     $bold eval `scram runtime -sh` $normal
871    
872    
873 williamc 1.29 ENDTEXT
874     }
875    
876     sub helpheader {
877     my $label=shift;
878     my @sub=@_;
879    
880     my $substring;
881     if ( @sub ) {
882     $substring=join ' - ', @sub;
883     }
884     else {
885     $substring="";
886     }
887     print <<ENDTEXT;
888     *************************************************************************
889     SCRAM HELP ---------$bold scram $substring $label $normal
890     *************************************************************************
891 williamc 1.28 ENDTEXT
892     }