-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First draft of a CommandLineHandler subclass for Cinic
- Loading branch information
Showing
8 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
3 changes: 3 additions & 0 deletions
3
Cinic-Core.package/CinicCommandLineHandler.class/class/commandName.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
commandName | ||
^ 'cinic' |
3 changes: 3 additions & 0 deletions
3
Cinic-Core.package/CinicCommandLineHandler.class/class/description.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
description | ||
^ 'Loads a Cinic configuration from a json cinic configuration file' |
8 changes: 8 additions & 0 deletions
8
Cinic-Core.package/CinicCommandLineHandler.class/instance/activate.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
validation | ||
activate | ||
self activateHelp ifTrue: [ ^ self ]. | ||
self validateConfigurationFile. | ||
self createConfigurationFromFile. | ||
(self hasOption: 'save') | ||
ifTrue: [ Smalltalk snapshot: true andQuit: false ]. | ||
self exitSuccess |
5 changes: 5 additions & 0 deletions
5
Cinic-Core.package/CinicCommandLineHandler.class/instance/createConfigurationFromFile.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
validation | ||
createConfigurationFromFile | ||
| file cinicConfig | | ||
file := self firstJsonFileArgument. | ||
cinicConfig := Cinic readFileNamed: file asFileReference. |
4 changes: 4 additions & 0 deletions
4
Cinic-Core.package/CinicCommandLineHandler.class/instance/firstJsonFileArgument.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
validation | ||
firstJsonFileArgument | ||
^ self arguments detect: [ :arg| | ||
arg endsWith: '.json' ] |
5 changes: 5 additions & 0 deletions
5
Cinic-Core.package/CinicCommandLineHandler.class/instance/validateConfigurationFile.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
validation | ||
validateConfigurationFile | ||
"The command line handle should have one .json file" | ||
(self commandLine hasFileWithExtension: '.json') | ||
ifFalse: [ ^ self exitFailure: 'There should be one JSON file as argument' ] |
11 changes: 11 additions & 0 deletions
11
Cinic-Core.package/CinicCommandLineHandler.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"commentStamp" : "", | ||
"super" : "CommandLineHandler", | ||
"category" : "Cinic-Core", | ||
"classinstvars" : [ ], | ||
"pools" : [ ], | ||
"classvars" : [ ], | ||
"instvars" : [ ], | ||
"name" : "CinicCommandLineHandler", | ||
"type" : "normal" | ||
} |