sequenceDiagram
participant User
participant CLI as Tuist CLI
participant Browser
participant Server as Tuist Server
participant Storage as Storage
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
| func run() throws { | |
| print(template) | |
| print(attributes) | |
| } |
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
| enum CodingKeys: CodingKey { | |
| case template | |
| case dynamic(String) | |
| init?(stringValue: String) { | |
| switch stringValue { | |
| case "template": | |
| self = .template | |
| case stringValue where Scaffold.attributes.contains(stringValue): | |
| self = .dynamic(stringValue) |
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
| enum CodingKeys: String, CodingKey { | |
| case template | |
| } | |
| init(from decoder: Decoder) throws { | |
| let container = try decoder.container(keyedBy: CodingKeys.self) | |
| template = try container.decode(Argument<String>.self, forKey: .template).wrappedValue | |
| } | |
| // Necessary for conforming ParsableArguments |
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
| @Option(name: .shortAndLong) | |
| var name: String |
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
| extension Scaffold: CustomReflectable { | |
| var customMirror: Mirror { | |
| // #1 | |
| let attributesChildren: [Mirror.Child] = Scaffold.attributes | |
| // #2 | |
| .map { | |
| (name: $0, option: Option<String>(name: .shortAndLong)) | |
| } | |
| // #3 | |
| .map { |
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
| static var attributes: [String] = [] | |
| static func preprocess(_ arguments: [String]) throws { | |
| ... | |
| let attributes: [String] = try JSONDecoder().decode([String].self, from: data) | |
| Scaffold.attributes = attributes | |
| } |
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
| extension ArgumentSet { | |
| init(_ type: ParsableArguments.Type) { | |
| let a: [ArgumentSet] = Mirror(reflecting: type.init()) | |
| .children | |
| .compactMap { child in | |
| guard | |
| var codingKey = child.label, | |
| let parsed = child.value as? ArgumentSetProvider | |
| else { return nil } |
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
| struct Scaffold: ParsableCommand { | |
| @Argument() | |
| var template: String | |
| } |
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 { | |
| } |
NewerOlder