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