Skip to content

Commit

Permalink
First draft of a CommandLineHandler subclass for Cinic
Browse files Browse the repository at this point in the history
  • Loading branch information
stonesong committed Jan 23, 2020
1 parent 635e6a3 commit 45c9d9b
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 0 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
commandName
^ 'cinic'
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'
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
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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
validation
firstJsonFileArgument
^ self arguments detect: [ :arg|
arg endsWith: '.json' ]
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 Cinic-Core.package/CinicCommandLineHandler.class/properties.json
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"
}

0 comments on commit 45c9d9b

Please sign in to comment.