Add new Flag to every command to choose if we want to generate static members or not
Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit

This commit is contained in:
2022-08-31 15:18:44 +02:00
parent 264c221604
commit 3d60513c08
24 changed files with 323 additions and 144 deletions

View File

@ -0,0 +1,45 @@
//
// ColorsConfiguration+ShellCommandable.swift
//
//
// Created by Thibaut Schmitt on 30/08/2022.
//
import Foundation
extension ColorsConfiguration: Runnable {
func run(force: Bool) {
var args = [String]()
if force {
args += ["-f"]
}
args += [
inputFile,
"--style",
style,
"--xcassets-path",
xcassetsPath,
"--extension-output-path",
extensionOutputPath,
"--static-members",
"\(staticMembersOptions)"
]
if let extensionName = extensionName {
args += [
"--extension-name",
extensionName
]
}
if let extensionSuffix = extensionSuffix {
args += [
"--extension-suffix",
extensionSuffix
]
}
Colors.main(args)
}
}

View File

@ -0,0 +1,42 @@
//
// FontsConfiguration+ShellCommandable.swift
//
//
// Created by Thibaut Schmitt on 30/08/2022.
//
import Foundation
extension FontsConfiguration: Runnable {
func run(force: Bool) {
var args = [String]()
if force {
args += ["-f"]
}
args += [
inputFile,
"--extension-output-path",
extensionOutputPath,
"--static-members",
"\(staticMembersOptions)"
]
if let extensionName = extensionName {
args += [
"--extension-name",
extensionName
]
}
if let extensionSuffix = extensionSuffix {
args += [
"--extension-suffix",
extensionSuffix
]
}
Fonts.main(args)
}
}

View File

@ -0,0 +1,43 @@
//
// ImagesConfiguration+ShellCommandable.swift
//
//
// Created by Thibaut Schmitt on 30/08/2022.
//
import Foundation
extension ImagesConfiguration: Runnable {
func run(force: Bool) {
var args = [String]()
if force {
args += ["-F"] // Images has a -f and -F options
}
args += [
inputFile,
"--xcassets-path",
xcassetsPath,
"--extension-output-path",
extensionOutputPath,
"--static-members",
"\(staticMembersOptions)"
]
if let extensionName = extensionName {
args += [
"--extension-name",
extensionName
]
}
if let extensionSuffix = extensionSuffix {
args += [
"--extension-suffix",
extensionSuffix
]
}
Images.main(args)
}
}

View File

@ -0,0 +1,13 @@
//
// ShellCommandable.swift
//
//
// Created by Thibaut Schmitt on 30/08/2022.
//
import Foundation
protocol Runnable {
func run(force: Bool)
}

View File

@ -0,0 +1,48 @@
//
// StringsConfiguration+ShellCommandable.swift
//
//
// Created by Thibaut Schmitt on 30/08/2022.
//
import Foundation
extension StringsConfiguration: Runnable {
func run(force: Bool) {
var args = [String]()
if force {
args += ["-f"]
}
args += [
inputFile,
"--output-path",
outputPath,
"--langs",
langs,
"--default-lang",
defaultLang,
"--extension-output-path",
extensionOutputPath,
"--static-members",
"\(staticMembersOptions)"
]
if let extensionName = extensionName {
args += [
"--extension-name",
extensionName
]
}
if let extensionSuffix = extensionSuffix {
args += [
"--extension-suffix",
extensionSuffix
]
}
Stringium.main(args)
}
}

View File

@ -0,0 +1,43 @@
//
// TagsConfiguration+ShellCommandable.swift
//
//
// Created by Thibaut Schmitt on 30/08/2022.
//
import Foundation
extension TagsConfiguration: Runnable {
func run(force: Bool) {
var args = [String]()
if force {
args += ["-f"]
}
args += [
inputFile,
"--lang",
lang,
"--extension-output-path",
extensionOutputPath,
"--static-members",
"\(staticMembersOptions)"
]
if let extensionName = extensionName {
args += [
"--extension-name",
extensionName
]
}
if let extensionSuffix = extensionSuffix {
args += [
"--extension-suffix",
extensionSuffix
]
}
Tags.main(args)
}
}