Created
September 9, 2020 14:51
-
-
Save fortmarek/46aa4d428a42a5dc8d0e2b6d907cbd6c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import ArgumentParser | |
import Foundation | |
struct Scaffold: ParsableCommand { | |
@Argument() | |
var template: String | |
func run() throws { | |
} | |
static func preprocess(_ arguments: [String]) throws { | |
// Obtaining template name | |
let templateName = arguments[1] | |
// Based on template name find its manifest | |
let manifestPath = FileManager.default.currentDirectoryPath + "/\(templateName)/manifest.json" | |
// Obtain data | |
let data = try Data(contentsOf: URL(fileURLWithPath: manifestPath)) | |
// Parse the attributes | |
let attributes: [String] = try JSONDecoder().decode([String].self, from: data) | |
print(attributes) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment