xtool.git
Publicgit clone https://git.maproj.org/xtool.gitxtool.git / Sources / XToolSupport / UninstallCommand.swift
UninstallCommand.swift32 lines · 857 BRaw
| 1 | import Foundation |
| 2 | import XKit |
| 3 | import SwiftyMobileDevice |
| 4 | import ArgumentParser |
| 5 | |
| 6 | struct UninstallCommand: AsyncParsableCommand { |
| 7 | static let configuration = CommandConfiguration( |
| 8 | commandName: "uninstall", |
| 9 | abstract: "Uninstall an installed app" |
| 10 | ) |
| 11 | |
| 12 | @OptionGroup var connectionOptions: ConnectionOptions |
| 13 | |
| 14 | @Argument( |
| 15 | help: "The app to uninstall" |
| 16 | ) var bundleID: String |
| 17 | |
| 18 | func run() async throws { |
| 19 | let client = try await connectionOptions.client() |
| 20 | let installProxy = try InstallationProxyClient(device: client.device, label: "xtool-inst") |
| 21 | do { |
| 22 | try await installProxy.uninstall( |
| 23 | bundleID: bundleID, |
| 24 | progress: { _ in } |
| 25 | ) |
| 26 | } catch { |
| 27 | print("Failed: \(error)") |
| 28 | return |
| 29 | } |
| 30 | print("Success!") |
| 31 | } |
| 32 | } |