class: GetOpt
authorClaus Gittinger <cg@exept.de>
Thu, 03 Jul 2014 20:46:44 +0200
changeset 16690 445461b9df6c
parent 16689 f89b6104fb6b
child 16691 2a12b888e973
class: GetOpt class definition added: #error: #onError:
GetOpt.st
--- a/GetOpt.st	Thu Jul 03 20:33:45 2014 +0200
+++ b/GetOpt.st	Thu Jul 03 20:46:44 2014 +0200
@@ -19,7 +19,7 @@
 "{ Package: 'stx:libbasic' }"
 
 Dictionary subclass:#GetOpt
-	instanceVariableNames:'defaultBlock'
+	instanceVariableNames:'defaultBlock onErrorBlock'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'System-Support'
@@ -144,6 +144,19 @@
 
 default: unaryBlock 
     defaultBlock := unaryBlock
+!
+
+onError: unaryBlock 
+    onErrorBlock := unaryBlock
+! !
+
+!GetOpt methodsFor:'error reporting'!
+
+error:aMessage
+    onErrorBlock notNil ifTrue:[
+        onErrorBlock value:aMessage
+    ].
+    super error:aMessage
 ! !
 
 !GetOpt methodsFor:'initialization'!
@@ -234,5 +247,6 @@
 !GetOpt class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/GetOpt.st,v 1.3 2012-05-14 11:02:49 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/GetOpt.st,v 1.4 2014-07-03 18:46:44 cg Exp $'
 ! !
+