Modern Apps git

xtool.git

Public
git clone https://git.maproj.org/xtool.git
appstore-distribution ▾

xtool.git / Sources / XToolSupport / UninstallCommand.swift

UninstallCommand.swift32 lines · 857 BRaw
1import Foundation
2import XKit
3import SwiftyMobileDevice
4import ArgumentParser
5
6struct 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}