xtool.git
Publicgit clone https://git.maproj.org/xtool.gitxtool.git / Sources / XToolSupport / SetupCommand.swift
SetupCommand.swift29 lines · 728 BRaw
| 1 | import ArgumentParser |
| 2 | import Foundation |
| 3 | import XKit |
| 4 | import PackLib |
| 5 | |
| 6 | struct SetupCommand: AsyncParsableCommand { |
| 7 | static let configuration = CommandConfiguration( |
| 8 | commandName: "setup", |
| 9 | abstract: "Set up xtool for iOS development", |
| 10 | discussion: """ |
| 11 | Authenticates with Apple if needed, then adds the iOS SDK to SwiftPM. |
| 12 | |
| 13 | Equivalent to running `xtool auth && xtool sdk` |
| 14 | """ |
| 15 | ) |
| 16 | |
| 17 | func run() async throws { |
| 18 | try await SetupOperation().run() |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | struct SetupOperation { |
| 23 | var quiet = false |
| 24 | |
| 25 | func run() async throws { |
| 26 | try await AuthOperation(logoutFromExisting: false, quiet: quiet).run() |
| 27 | try await EnsureSDKOperation(quiet: quiet).run() |
| 28 | } |
| 29 | } |