* for more details.
*/
+import ArgumentParser
import Foundation
-print("Configuring build tooling.")
-
-installIfMissing("git", "xcode-select --install")
-installIfMissing(
- "brew",
- "curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | /bin/bash",
- installCommandEnv: ["NONINTERACTIVE": "1"]
-)
-installIfMissing("inkscape", "brew install inkscape")
-installIfMissing("python3", "brew install pyenv && pyenv install 3.12.4")
-
-print("Build tooling configured.")
-print("Configuring KDE Craft.")
-
-let fm = FileManager.default
-let currentDir = fm.currentDirectoryPath
-let craftMasterDir = "\(currentDir)/craftmaster"
-
-if fm.fileExists(atPath: craftMasterDir) {
- print("KDE Craft is already cloned.")
-} else {
- print("Cloning KDE Craft...")
- shell("git clone --depth=1 https://invent.kde.org/packaging/craftmaster.git \(craftMasterDir)")
-}
+struct MacCrafter: ParsableCommand {
+ static let configuration = CommandConfiguration(
+ abstract: "A Swift command-line tool to manage blog post banners"
+ )
+
+ enum MacCrafterError: Error {
+ case failedEnumeration(String)
+ }
+
+ mutating func run() throws {
+ print("Configuring build tooling.")
+
+ installIfMissing("git", "xcode-select --install")
+ installIfMissing(
+ "brew",
+ "curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | /bin/bash",
+ installCommandEnv: ["NONINTERACTIVE": "1"]
+ )
+ installIfMissing("inkscape", "brew install inkscape")
+ installIfMissing("python3", "brew install pyenv && pyenv install 3.12.4")
+
+ print("Build tooling configured.")
+ print("Configuring KDE Craft.")
-print("Configuring Nextcloud Desktop Client blueprints for KDE Craft...")
+ let fm = FileManager.default
+ let currentDir = fm.currentDirectoryPath
+ let craftMasterDir = "\(currentDir)/craftmaster"
-let repoRootDir = "\(currentDir)/../.."
-let craftMasterIni = "\(repoRootDir)/craftmaster.ini"
-let craftMasterPy = "\(craftMasterDir)/CraftMaster.py"
-let craftTarget = "macos-clang-arm64"
-let craftCommand = "python3 \(craftMasterPy) --config \(craftMasterIni) --target \(craftTarget) -c"
-let clientBlueprintsGitUrl = "https://github.com/nextcloud/desktop-client-blueprints.git"
-shell("\(craftCommand) --add-blueprint-repository \(clientBlueprintsGitUrl)")
+ if fm.fileExists(atPath: craftMasterDir) {
+ print("KDE Craft is already cloned.")
+ } else {
+ print("Cloning KDE Craft...")
+ shell("git clone --depth=1 https://invent.kde.org/packaging/craftmaster.git \(craftMasterDir)")
+ }
-print("Crafting KDE Craft...")
-shell("\(craftCommand) craft")
+ print("Configuring Nextcloud Desktop Client blueprints for KDE Craft...")
-print("Crafting Nextcloud Desktop Client dependencies...")
-shell("\(craftCommand) --install-deps nextcloud-client")
+ let repoRootDir = "\(currentDir)/../.."
+ let craftMasterIni = "\(repoRootDir)/craftmaster.ini"
+ let craftMasterPy = "\(craftMasterDir)/CraftMaster.py"
+ let craftTarget = "macos-clang-arm64"
+ let craftCommand = "python3 \(craftMasterPy) --config \(craftMasterIni) --target \(craftTarget) -c"
+ let clientBlueprintsGitUrl = "https://github.com/nextcloud/desktop-client-blueprints.git"
+ shell("\(craftCommand) --add-blueprint-repository \(clientBlueprintsGitUrl)")
+
+ print("Crafting KDE Craft...")
+ shell("\(craftCommand) craft")
+
+ print("Crafting Nextcloud Desktop Client dependencies...")
+ shell("\(craftCommand) --install-deps nextcloud-client")
+
+ print("Crafting Nextcloud Desktop Client...")
+ shell("\(craftCommand) --src-dir \(repoRootDir) nextcloud-client")
+ }
+}
-print("Crafting Nextcloud Desktop Client...")
-shell("\(craftCommand) --src-dir \(repoRootDir) nextcloud-client")
+MacCrafter.main()