Files
Kabir Oberai 4077e1a0b8 Add build --sign option (#224)
Running `xtool dev build --sign [--ipa]` will produce a codesigned
app/ipa, without installing
2026-05-16 22:40:45 -04:00

47 lines
1.3 KiB
Swift

import Foundation
import XKit
import SwiftyMobileDevice
import ArgumentParser
struct InstallCommand: AsyncParsableCommand {
static let configuration = CommandConfiguration(
commandName: "install",
abstract: "Install an ipa file to your device"
)
@OptionGroup var connectionOptions: ConnectionOptions
@Argument(
help: "The path to a custom app/ipa to install"
) var path: String
func run() async throws {
let token = try AuthToken.saved()
let client = try await connectionOptions.client()
print("Installing to device: \(client.deviceName) (udid: \(client.udid))")
let installDelegate = XToolInstallerDelegate()
let installer = IntegratedInstaller(
auth: token.authData(),
delegate: installDelegate
)
do {
try await installer.install(
app: URL(fileURLWithPath: path),
udid: client.udid,
lookupMode: .only(client.connectionType),
configureDevice: false,
)
print("\nSuccessfully installed!")
} catch let error as CancellationError {
throw error
} catch {
print("\nError: \(error)")
throw ExitCode.failure
}
}
}