<div dir="ltr">+1, please include in the update.mcm!<br>I also like the Pharo alternative to Fuel out the error context...<br>Lighter than full image save. Oh but we don&#39;t have Fuel yet :(<br>Who wants to make it with a segment?<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/10/31  <span dir="ltr">&lt;<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Frank Shearar uploaded a new version of CommandLine to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/CommandLine-fbs.1.mcz" target="_blank">http://source.squeak.org/trunk/CommandLine-fbs.1.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: CommandLine-fbs.1<br>
Author: fbs<br>
Time: 31 October 2013, 10:32:52.821 pm<br>
UUID: dc871e85-bd16-d742-acbf-4d2b838113d1<br>
Ancestors:<br>
<br>
CommandLineToolSet does little more than dump errors to stderr.<br>
<br>
DummyUIManager comes from Pharo via Pavel Krivanek&#39;s minimising script.<br>
<br>
==================== Snapshot ====================<br>
<br>
SystemOrganization addCategory: #&#39;CommandLine-Tools&#39;!<br>
SystemOrganization addCategory: #&#39;CommandLine-UIManager&#39;!<br>
<br>
UIManager subclass: #DummyUIManager<br>
        instanceVariableNames: &#39;&#39;<br>
        classVariableNames: &#39;&#39;<br>
        poolDictionaries: &#39;&#39;<br>
        category: &#39;CommandLine-UIManager&#39;!<br>
<br>
!DummyUIManager commentStamp: &#39;fbs 10/31/2013 07:36&#39; prior: 0!<br>
I&#39;m an alternative UIManager used to run an the image without GUI.  I redefine methods which require user input as these requests are irrelevant in a headless environment. !<br>
<br>
----- Method: DummyUIManager&gt;&gt;checkForNewDisplaySize (in category &#39;display&#39;) -----<br>
checkForNewDisplaySize<br>
        Display extent = DisplayScreen actualScreenSize ifTrue: [^ self].<br>
        DisplayScreen startUp.<br>
!<br>
<br>
----- Method: DummyUIManager&gt;&gt;chooseDirectory:from: (in category &#39;ui requests&#39;) -----<br>
chooseDirectory: label from: dir<br>
        ^ nil!<br>
<br>
----- Method: DummyUIManager&gt;&gt;chooseFrom:lines:title: (in category &#39;ui requests&#39;) -----<br>
chooseFrom: aList lines: linesArray title: aString<br>
        ^ aList first!<br>
<br>
----- Method: DummyUIManager&gt;&gt;chooseFrom:values:lines:title: (in category &#39;ui requests&#39;) -----<br>
chooseFrom: labelList values: valueList lines: linesArray title: aString<br>
        ^ valueList first!<br>
<br>
----- Method: DummyUIManager&gt;&gt;confirm: (in category &#39;ui requests&#39;) -----<br>
confirm: queryString<br>
        (ProvideAnswerNotification signal: queryString)<br>
                ifNotNil: [:answer|^answer].<br>
<br>
        self error: &#39;No user response possible&#39;!<br>
<br>
----- Method: DummyUIManager&gt;&gt;confirm:orCancel: (in category &#39;ui requests&#39;) -----<br>
confirm: aString orCancel: cancelBlock<br>
        (ProvideAnswerNotification signal: aString) ifNotNil: [:answer |<br>
        ^answer == #cancel ifTrue: [cancelBlock value] ifFalse: [answer]].<br>
<br>
        self error: &#39;No user response possible&#39;!<br>
<br>
----- Method: DummyUIManager&gt;&gt;displayProgress:at:from:to:during: (in category &#39;ui requests&#39;) -----<br>
displayProgress: titleString at: aPoint from: minVal to: maxVal during: workBlock<br>
        ^ workBlock value: Association new!<br>
<br>
----- Method: DummyUIManager&gt;&gt;edit:label:accept: (in category &#39;ui requests&#39;) -----<br>
edit: aText label: labelString accept: anAction<br>
        ^ nil!<br>
<br>
----- Method: DummyUIManager&gt;&gt;fontFromUser: (in category &#39;ui requests&#39;) -----<br>
fontFromUser: priorFont<br>
        self error: &#39;No user response possible&#39;!<br>
<br>
----- Method: DummyUIManager&gt;&gt;inform: (in category &#39;ui requests&#39;) -----<br>
inform: aString<br>
        &quot;Nothing to be done here&quot;!<br>
<br>
----- Method: DummyUIManager&gt;&gt;informUserDuring: (in category &#39;ui requests&#39;) -----<br>
informUserDuring: aBlock<br>
        aBlock value: nil!<br>
<br>
----- Method: DummyUIManager&gt;&gt;newDisplayDepthNoRestore: (in category &#39;display&#39;) -----<br>
newDisplayDepthNoRestore: pixelSize<br>
        &quot;Change depths.  Check if there is enough space!!  , di&quot;<br>
        | area need |<br>
        pixelSize = Display depth ifTrue: [^ self  &quot;no change&quot;].<br>
        pixelSize abs &lt; Display depth ifFalse:<br>
                [&quot;Make sure there is enough space&quot;<br>
                area := Display boundingBox area. &quot;pixels&quot;<br>
<br>
                need := (area * (pixelSize abs - Display depth) // 8)  &quot;new bytes needed&quot;<br>
                                + Smalltalk lowSpaceThreshold.<br>
                (Smalltalk garbageCollectMost &lt;= need<br>
                        and: [Smalltalk garbageCollect &lt;= need])<br>
                        ifTrue: [self error: &#39;Insufficient free space&#39;]].<br>
        Display setExtent: Display extent depth: pixelSize.<br>
<br>
        DisplayScreen startUp!<br>
<br>
----- Method: DummyUIManager&gt;&gt;request:initialAnswer: (in category &#39;ui requests&#39;) -----<br>
request: queryString initialAnswer: defaultAnswer<br>
        (ProvideAnswerNotification signal: queryString)<br>
        ifNotNil: [:answer |<br>
            ^ answer == #default ifTrue: [defaultAnswer] ifFalse: [answer]].<br>
<br>
        self error: &#39;No user response possible&#39;!<br>
<br>
----- Method: DummyUIManager&gt;&gt;requestPassword: (in category &#39;ui requests&#39;) -----<br>
requestPassword: queryString<br>
        ^ self request: queryString initialAnswer: &#39;&#39;!<br>
<br>
----- Method: DummyUIManager&gt;&gt;restoreDisplay (in category &#39;display&#39;) -----<br>
restoreDisplay!<br>
<br>
----- Method: DummyUIManager&gt;&gt;restoreDisplayAfter: (in category &#39;display&#39;) -----<br>
restoreDisplayAfter: aBlock<br>
        aBlock value.<br>
        Sensor waitButton.!<br>
<br>
StandardToolSet subclass: #CommandLineToolSet<br>
        instanceVariableNames: &#39;&#39;<br>
        classVariableNames: &#39;SaveSnapshotOnError&#39;<br>
        poolDictionaries: &#39;&#39;<br>
        category: &#39;CommandLine-Tools&#39;!<br>
<br>
----- Method: CommandLineToolSet class&gt;&gt;debugError: (in category &#39;debugging&#39;) -----<br>
debugError: anError<br>
        &quot;Print out a sensible stack trace and bail&quot;<br>
        | problemPlace s |<br>
        self saveSnapshotOnError<br>
                ifTrue: [Smalltalk saveAs: &#39;Debug-&#39; , (Smalltalk imageName subStrings: &#39;/&#39;) last].<br>
        problemPlace := anError signalerContext.<br>
        s := FileStream stderr.<br>
        (anError isKindOf: MessageNotUnderstood) ifTrue: [<br>
                s<br>
                        nextPutAll: anError messageText; cr;<br>
                        nextPutAll: problemPlace sender methodNode printString; cr].<br>
        (problemPlace stackOfSize: 20) do: [:ctx | s cr. ctx printOn: s].<br>
        s flush.<br>
<br>
        SmalltalkImage current snapshot: false andQuit: true!<br>
<br>
----- Method: CommandLineToolSet class&gt;&gt;debugSyntaxError: (in category &#39;debugging&#39;) -----<br>
debugSyntaxError: anError<br>
        | s |<br>
        s := FileStream stderr.<br>
        s nextPutAll: &#39;----- Syntax error -----&#39;; cr.<br>
        s nextPutAll: anError errorCode; cr.<br>
        s nextPutAll: &#39;----- Syntax error -----&#39;; cr.<br>
<br>
        self debugError: anError!<br>
<br>
----- Method: CommandLineToolSet class&gt;&gt;saveSnapshotOnError (in category &#39;preferences&#39;) -----<br>
saveSnapshotOnError<br>
        &lt;preference: &#39;Save snapshot of image on failure&#39;<br>
        category: &#39;debug&#39;<br>
        description: &#39;If true, saves a snapshot of the failing image to the current directory.&#39;<br>
        type: #Boolean&gt;<br>
        ^ SaveSnapshotOnError ifNil: [SaveSnapshotOnError := false].!<br>
<br>
----- Method: CommandLineToolSet class&gt;&gt;saveSnapshotOnError: (in category &#39;preferences&#39;) -----<br>
saveSnapshotOnError: aBoolean<br>
        SaveSnapshotOnError := aBoolean.!<br>
<br>
----- Method: CommandLineToolSet class&gt;&gt;unload (in category &#39;class initialization&#39;) -----<br>
unload<br>
        ToolSet unregister: self.!<br>
<br>
<br>
</blockquote></div><br></div>