Skip to content

Instantly share code, notes, and snippets.

@fortmarek
Created September 9, 2020 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fortmarek/46aa4d428a42a5dc8d0e2b6d907cbd6c to your computer and use it in GitHub Desktop.
Save fortmarek/46aa4d428a42a5dc8d0e2b6d907cbd6c to your computer and use it in GitHub Desktop.
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