@@ -6,7 +6,7 @@ import ArgumentParser
66#if os(macOS)
77@main
88struct cli : ParsableCommand {
9- @Argument ( help: " Path to a folder that contains 1.1F2/ and 1.2T/ " )
9+ @Argument ( help: " Path to a folder that contains 1.1F2/, 1.2T/ and Custom / " )
1010 var input : String
1111
1212 static let v11Refs : [ String ] = [
@@ -144,7 +144,12 @@ struct cli: ParsableCommand {
144144 " struct-frag-01-t " ,
145145 " struct-use-03-t " ,
146146 ]
147-
147+
148+ static let customRefs : [ String ] = [
149+ " viewport-01 " ,
150+ " viewport-02 " ,
151+ ]
152+
148153 mutating func run( ) throws {
149154 let inputURL = URL ( fileURLWithPath: input)
150155
@@ -154,9 +159,10 @@ struct cli: ParsableCommand {
154159
155160 let v11FolderURL = inputURL. appendingPathComponent ( " 1.1F2 " )
156161 let v12FolderURL = inputURL. appendingPathComponent ( " 1.2T " )
157-
158- guard FileManager . default. fileExists ( atPath: v11FolderURL. path) || FileManager . default. fileExists ( atPath: v12FolderURL. path) else {
159- throw ValidationError ( " 1.1F2/ or 1.2T/ folder does not exist in ' \( input) ' " )
162+ let customFolderURL = inputURL. appendingPathComponent ( " Custom " )
163+
164+ guard FileManager . default. fileExists ( atPath: v11FolderURL. path) || FileManager . default. fileExists ( atPath: v12FolderURL. path) || FileManager . default. fileExists ( atPath: customFolderURL. path) else {
165+ throw ValidationError ( " 1.1F2/, 1.2T/ or Custom/ folder does not exist in ' \( input) ' " )
160166 }
161167
162168 for ref in Self . v11Refs {
@@ -172,6 +178,13 @@ struct cli: ParsableCommand {
172178 let refURL = v12FolderURL. appending ( path: " refs/ \( ref) .ref " )
173179 try svgContent. write ( to: refURL, atomically: true , encoding: . utf8)
174180 }
181+
182+ for ref in Self . customRefs {
183+ let svgURL = customFolderURL. appending ( path: " svg/ \( ref) .svg " )
184+ let svgContent = try serialize ( inputURL: svgURL)
185+ let refURL = customFolderURL. appending ( path: " refs/ \( ref) .ref " )
186+ try svgContent. write ( to: refURL, atomically: true , encoding: . utf8)
187+ }
175188 }
176189
177190 private func serialize( inputURL: URL ) throws -> String {
0 commit comments