localized/Sources/Generation/Generation.swift
david-swift 97d086a7bb
All checks were successful
Deploy Docs / publish (push) Successful in 18s
SwiftLint / SwiftLint (push) Successful in 6s
Migrate to the Aparoksha Gitea instance
2024-10-07 14:58:15 +02:00

28 lines
727 B
Swift

//
// Generation.swift
// Localized
//
// Created by david-swift on 02.03.2024.
//
import Foundation
import GenerationLibrary
try Generation.main()
/// A type containing the generation function for the plugin.
public enum Generation {
/// Generate the Swift code for the plugin.
public static func main() throws {
let yml = try String(contentsOfFile: CommandLine.arguments[1])
let content = try GenerationLibrary.Generation.getCode(yml: yml)
let outputPathIndex = 2
_ = FileManager.default.createFile(
atPath: CommandLine.arguments[outputPathIndex],
contents: .init(("import Localized" + "\n\n" + content[0] + "\n\n" + content[1]).utf8)
)
}
}