Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit
54 lines
1.4 KiB
Swift
54 lines
1.4 KiB
Swift
//
|
|
// StringsConfiguration+Runnable.swift
|
|
//
|
|
//
|
|
// Created by Thibaut Schmitt on 30/08/2022.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
extension StringsConfiguration: Runnable {
|
|
|
|
func run(projectDirectory: String, force: Bool) {
|
|
let args = getArguments(projectDirectory: projectDirectory, force: force)
|
|
Stringium.main(args)
|
|
}
|
|
|
|
func getArguments(projectDirectory: String, force: Bool) -> [String] {
|
|
var args = [String]()
|
|
|
|
if force {
|
|
args += ["-f"]
|
|
}
|
|
|
|
args += [
|
|
inputFile.prependIfRelativePath(projectDirectory),
|
|
"--output-path",
|
|
outputPath.prependIfRelativePath(projectDirectory),
|
|
"--langs",
|
|
langs,
|
|
"--default-lang",
|
|
defaultLang
|
|
]
|
|
|
|
// Add optional parameters
|
|
[
|
|
("--extension-output-path", extensionOutputPath?.prependIfRelativePath(projectDirectory)),
|
|
("--extension-name", extensionName),
|
|
("--extension-suffix", extensionSuffix),
|
|
("--visibility", visibility),
|
|
("--xc-strings", staticMembers?.description),
|
|
("--static-members", xcStrings?.description)
|
|
].forEach { argumentName, argumentValue in
|
|
if let argumentValue {
|
|
args += [
|
|
argumentName,
|
|
argumentValue
|
|
]
|
|
}
|
|
}
|
|
|
|
return args
|
|
}
|
|
}
|