--help improved
authorJan Vrany <jan.vrany@fit.cvut.cz>
Fri, 13 Jan 2012 13:31:39 +0100
changeset 77 90d1dd533087
parent 76 4c992db5503a
child 78 d3f87f298062
--help improved
reports/Builder__ReportRunner.st
--- a/reports/Builder__ReportRunner.st	Fri Jan 13 13:31:31 2012 +0100
+++ b/reports/Builder__ReportRunner.st	Fri Jan 13 13:31:39 2012 +0100
@@ -67,6 +67,13 @@
 
 !ReportRunner class methodsFor:'defaults'!
 
+allowCoverageMeasurementOption
+
+    ^false "CoverageReport will do that"
+
+    "Created: / 13-01-2012 / 11:48:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 allowDebugOption
 
     ^true
@@ -108,6 +115,42 @@
     debugging := true.
 
     "Created: / 06-11-2011 / 22:06:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+usage
+
+    Stderr nextPutAll:'usage: report-runner.';
+           nextPutAll: (OperatingSystem isMSWINDOWSlike ifTrue:['bat'] ifFalse:['sh']);
+           nextPutAll: ' [-D <dir>] -r <report> [-p <package1> [-p <package2> [...]]]'; cr.
+
+    Stderr nextPutLine:'  --help .................. output this message'.
+    Stderr nextPutLine:'  --verbose ............... verbose startup'.
+    Stderr nextPutLine:'  --noBanner .............. no splash screen'.
+    Stderr nextPutLine:'  --newAppInstance ........ start as its own application process (do not reuse a running instance)'.
+    self allowScriptingOption ifTrue:[
+        Stderr nextPutLine:'  --scripting portNr ...... enable scripting via port (or stdin/stdOut, if 0)'.
+    ].
+    self allowDebugOption ifTrue:[
+        Stderr nextPutLine:'  --debug ................. enable Debugger'.
+    ].
+
+    "/                 '  ......................... '
+    Stderr nextPutLine:'  -D <dir>'.
+    Stderr nextPutLine:'  --output-directory=<dir>  directory where report files will go'.
+    Stderr nextPutLine:'  -r <report class>'.
+    Stderr nextPutLine:'  --report=<report class> . report to run. available reports:'.
+    Report available do:[:report|
+        Stderr nextPutAll:'      '; nextPutLine: report name
+    ].
+    Stderr nextPutLine:'  -p <package>'.
+    Stderr nextPutLine:'  --package=<package> ..... package to run report on'.
+    Stderr nextPutLine:'                            May be specified multiple times.'.
+
+    "
+    self usage
+    "
+
+    "Created: / 13-01-2012 / 11:48:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !ReportRunner class methodsFor:'startup-to be redefined'!
@@ -145,84 +188,6 @@
     ]
 
     "Modified: / 07-11-2011 / 09:26:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-old_main:argv 
-    |argc reports outputDir i|
-
-    argc := argv size.
-    outputDir := Smalltalk commandLineArgumentNamed:'-o'.
-    outputDir 
-        ifNil:[outputDir := Smalltalk commandLineArgumentNamed:'--out-dir'.].
-    outputDir 
-        ifNotNil:[
-            outputDir asFilename exists ifFalse:[
-                outputDir asFilename recursiveMakeDirectory
-            ].
-            Report outputDir:outputDir.
-        ].
-    self 
-        verboseInfo:'Report dir: ' , (Smalltalk at:#'Builder::Report:OutputDir') asString.
-    reports := OrderedCollection new.
-    i := 1.
-    [
-        [
-            i := argv indexOf:'-r' startingAt:i.
-            i ~~ 0 and:[i < argc]
-        ] whileTrue:[
-            |reportName formatName report|
-
-            reportName := argv at:i + 1.
-            i := i + 2.
-            (report := Smalltalk at:reportName asSymbol) 
-                ifNil:[
-                    Stderr
-                        nextPutLine:'No class for report named ' , reportName;
-                        nextPutLine:'Ignoring'
-                ]
-                ifNotNil:[reports add:(report := report new)].
-            "Check for format"
-            i := argv indexOf:'-F' startingAt:i.
-            i ~~ 0 ifTrue:[
-                formatName := argv at:i + 1.
-                i := i + 2.
-                report format: formatName asSymbol.
-            ].
-        ].
-        i := 1.
-        [
-            i := argv indexOf:'-p' startingAt:i.
-            i ~~ 0 and:[i < argc]
-        ] whileTrue:[
-            |pkg|
-
-            pkg := argv at:i + 1.
-            i := i + 2.
-            reports do:[:report |
-                                self verboseInfo: 
-                                        ('Running %1 for package %2' bindWith: report name with: pkg).
-                report runPackage:pkg
-            ]
-        ].
-        Smalltalk isStandAloneApp ifTrue:[
-            Smalltalk exit:0.
-        ]
-    ] on:Error
-            do:[:ex | 
-        Stderr nextPutAll:'Error when running tests: '.
-        Stderr
-            nextPutAll:ex description;
-            cr.
-        ex suspendedContext printAllOn:Stderr.
-        Smalltalk isHeadless ifTrue:[
-            Smalltalk exit:1.
-        ] ifFalse:[
-            ex pass
-        ]
-    ]
-
-    "Modified: / 06-10-2011 / 23:33:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Created: / 06-11-2011 / 21:53:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !ReportRunner class methodsFor:'documentation'!