Modern Apps git

xtool.git

Public
git clone https://git.maproj.org/xtool.git
main ▾

xtool.git / macOS / XToolMac / XToolMac.swift

XToolMac.swift24 lines · 691 BRaw
1import Foundation
2import Dependencies
3import XToolSupport
4import XKit
5
6@main enum XToolMacMain {
7 static func main() async throws {
8 // the bin/xtool script invokes us with this env var, allowing us to
9 // detect command-line invocations vs a UI app launch
10 if ProcessInfo.processInfo.environment["XTL_CLI"] == "1" {
11 try await runXTool()
12 } else {
13 XToolMacUI.main()
14 }
15 }
16
17 private static func runXTool() async throws {
18 try await withDependencies {
19 $0.keyValueStorage = KeychainStorage(service: "sh.xtool.keychain.credentials")
20 } operation: {
21 try await XTool.run()
22 }
23 }
24}