This repository was archived by the owner on Mar 1, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +24
-20
lines changed
Expand file tree Collapse file tree 3 files changed +24
-20
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ platform :osx, '10.10'
33use_frameworks!
44plugin 'cocoapods-rome'
55
6+ pod 'Commander' , :git => 'https://github.com/kylef/Commander'
67pod 'PathKit' , '0.4.0-beta.1'
78pod 'Stencil' , :git => 'https://github.com/kylef/Stencil' , :branch => 'swift-2.0'
89
Original file line number Diff line number Diff line change 11PODS:
2+ - Commander (0.1.0)
23 - PathKit (0.4.0-beta.1)
34 - Stencil (0.2.0):
45 - PathKit (~> 0.4.0-beta.1)
56
67DEPENDENCIES:
8+ - Commander (from `https://github.com/kylef/Commander`)
79 - PathKit (= 0.4.0-beta.1)
810 - Stencil (from `https://github.com/kylef/Stencil`, branch `swift-2.0`)
911
1012EXTERNAL SOURCES:
13+ Commander:
14+ :git: https://github.com/kylef/Commander
1115 Stencil:
1216 :branch: swift-2.0
1317 :git: https://github.com/kylef/Stencil
1418
1519CHECKOUT OPTIONS:
20+ Commander:
21+ :commit: 12d1c1a104e2067f2cf7dc19a1106fbbfcc95e00
22+ :git: https://github.com/kylef/Commander
1623 Stencil:
1724 :commit: dcf2611ac24829ffe80cf46894ebc98fdda62e0c
1825 :git: https://github.com/kylef/Stencil
1926
2027SPEC CHECKSUMS:
28+ Commander: d67100926f8781c33b4cb82aa5d826bad78b4191
2129 PathKit: dd424f40892d4f60f279c8f2cd82503fc86e4dad
2230 Stencil: 4214b68cf5a5f24c74c8c6fbbb573e225c490f88
2331
24- COCOAPODS: 0.39.0.beta.4
32+ COCOAPODS: 0.38.2
Original file line number Diff line number Diff line change 11#!/usr/bin/env xcrun swift -F Rome
22
33import CoreData
4+ import Commander
45import PathKit
56import Stencil
67
@@ -201,26 +202,20 @@ func generate(modelPath:Path, outputPath:Path) {
201202 }
202203}
203204
204- func usage( ) {
205- let processName = Process . arguments. first!
206- print ( " Usage: \( processName) <model> <output-directory> " )
207- }
208-
209- func run( ) {
210- let arguments = Process . arguments
211-
212- if arguments. contains ( " --help " ) {
213- usage ( )
214- } else if arguments. contains ( " --version " ) {
215- print ( version)
216- } else if arguments. count != 3 {
217- usage ( )
218- } else {
219- let modelPath = Path ( arguments [ 1 ] )
220- let outputPath = Path ( arguments [ 2 ] )
221- generate ( modelPath, outputPath: outputPath)
205+ extension Path : ArgumentConvertible {
206+ public init ( parser: ArgumentParser ) throws {
207+ if let path = parser. shift ( ) {
208+ self . init ( path)
209+ } else {
210+ throw ArgumentError . MissingValue ( argument: nil )
211+ }
222212 }
223213}
224214
225- run ( )
215+ command (
216+ Argument < Path > ( " model " ) ,
217+ Argument < Path > ( " output " )
218+ ) { model, output in
219+ generate ( model, outputPath: output)
220+ } . run ( version)
226221
You can’t perform that action at this time.
0 commit comments