Renaming errors property: localizedDescription -> description
Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit
Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit
Re enabling generation of ressources on commond Architecture will now generate property of subobject as non-static. It will allow usage like R.sub_object.sub_property.property
This commit is contained in:
parent
fc427733ee
commit
9ab7e74991
@ -14,7 +14,7 @@ enum FontsToolError: Error {
|
|||||||
case fileNotExists(String)
|
case fileNotExists(String)
|
||||||
case writeExtension(String, String)
|
case writeExtension(String, String)
|
||||||
|
|
||||||
var localizedDescription: String {
|
var description: String {
|
||||||
switch self {
|
switch self {
|
||||||
case .extensionNamesCollision(let extensionName):
|
case .extensionNamesCollision(let extensionName):
|
||||||
return "error: [\(Fonts.toolName)] Error on extension names, extension name and SwiftUI extension name should be different (\(extensionName) is used on both)"
|
return "error: [\(Fonts.toolName)] Error on extension names, extension name and SwiftUI extension name should be different (\(extensionName) is used on both)"
|
||||||
|
@ -45,14 +45,14 @@ struct Generate: ParsableCommand {
|
|||||||
ArchitectureGenerator.writeArchitecture(architecture)
|
ArchitectureGenerator.writeArchitecture(architecture)
|
||||||
}
|
}
|
||||||
|
|
||||||
// // Execute commands
|
// Execute commands
|
||||||
// configuration.runnableConfigurations
|
configuration.runnableConfigurations
|
||||||
// .forEach {
|
.forEach {
|
||||||
// let begin = Date()
|
let begin = Date()
|
||||||
// $0.run(projectDirectory: options.projectDirectory,
|
$0.run(projectDirectory: options.projectDirectory,
|
||||||
// force: options.forceGeneration)
|
force: options.forceGeneration)
|
||||||
// print("Took: \(Date().timeIntervalSince(begin))s\n")
|
print("Took: \(Date().timeIntervalSince(begin))s\n")
|
||||||
// }
|
}
|
||||||
|
|
||||||
print("[\(Self.toolName)] Resgen ended")
|
print("[\(Self.toolName)] Resgen ended")
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ enum GenerateError: Error {
|
|||||||
case commandError([String], String)
|
case commandError([String], String)
|
||||||
case writeFile(String, String)
|
case writeFile(String, String)
|
||||||
|
|
||||||
var localizedDescription: String {
|
var description: String {
|
||||||
switch self {
|
switch self {
|
||||||
case .fileNotExists(let filename):
|
case .fileNotExists(let filename):
|
||||||
return "error: [\(Generate.toolName)] File \(filename) does not exists"
|
return "error: [\(Generate.toolName)] File \(filename) does not exists"
|
||||||
|
@ -45,18 +45,18 @@ struct ConfigurationArchitecture: Codable {
|
|||||||
let path: String?
|
let path: String?
|
||||||
let children: [ConfigurationArchitecture]?
|
let children: [ConfigurationArchitecture]?
|
||||||
|
|
||||||
func getProperty() -> String {
|
func getProperty(isStatic: Bool) -> String {
|
||||||
" static let \(property) = \(classname)()"
|
" \(isStatic ? "static " : "")let \(property) = \(classname)()"
|
||||||
}
|
}
|
||||||
|
|
||||||
func getClass() -> String {
|
func getClass(generateStaticProperty: Bool = true) -> String {
|
||||||
guard children?.isEmpty == false else {
|
guard children?.isEmpty == false else {
|
||||||
return "class \(classname) {}"
|
return "class \(classname) {}"
|
||||||
}
|
}
|
||||||
|
|
||||||
let classDefinition = [
|
let classDefinition = [
|
||||||
"class \(classname) {",
|
"class \(classname) {",
|
||||||
children?.map { $0.getProperty() }.joined(separator: "\n"),
|
children?.map { $0.getProperty(isStatic: generateStaticProperty) }.joined(separator: "\n"),
|
||||||
"}"
|
"}"
|
||||||
]
|
]
|
||||||
.compactMap { $0 }
|
.compactMap { $0 }
|
||||||
@ -70,7 +70,7 @@ struct ConfigurationArchitecture: Codable {
|
|||||||
func getSubclass() -> String? {
|
func getSubclass() -> String? {
|
||||||
guard let children else { return nil }
|
guard let children else { return nil }
|
||||||
return children.compactMap { arch in
|
return children.compactMap { arch in
|
||||||
arch.getClass()
|
arch.getClass(generateStaticProperty: false)
|
||||||
}
|
}
|
||||||
.joined(separator: "\n\n")
|
.joined(separator: "\n\n")
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ enum ImagesError: Error {
|
|||||||
case createAssetFolder(String)
|
case createAssetFolder(String)
|
||||||
case unknown(String)
|
case unknown(String)
|
||||||
|
|
||||||
var localizedDescription: String {
|
var description: String {
|
||||||
switch self {
|
switch self {
|
||||||
case .extensionNamesCollision(let extensionName):
|
case .extensionNamesCollision(let extensionName):
|
||||||
return "error: [\(Fonts.toolName)] Error on extension names, extension name and SwiftUI extension name should be different (\(extensionName) is used on both)"
|
return "error: [\(Fonts.toolName)] Error on extension names, extension name and SwiftUI extension name should be different (\(extensionName) is used on both)"
|
||||||
|
@ -14,7 +14,7 @@ enum StringiumError: Error {
|
|||||||
case writeFile(String, String)
|
case writeFile(String, String)
|
||||||
case langNotDefined(String, String, Bool)
|
case langNotDefined(String, String, Bool)
|
||||||
|
|
||||||
var localizedDescription: String {
|
var description: String {
|
||||||
switch self {
|
switch self {
|
||||||
case .fileNotExists(let filename):
|
case .fileNotExists(let filename):
|
||||||
return "error: [\(Stringium.toolName)] File \(filename) does not exists "
|
return "error: [\(Stringium.toolName)] File \(filename) does not exists "
|
||||||
|
@ -12,7 +12,7 @@ enum TwineError: Error {
|
|||||||
case langsListEmpty
|
case langsListEmpty
|
||||||
case defaultLangsNotInLangs
|
case defaultLangsNotInLangs
|
||||||
|
|
||||||
var localizedDescription: String {
|
var description: String {
|
||||||
switch self {
|
switch self {
|
||||||
case .fileNotExists(let filename):
|
case .fileNotExists(let filename):
|
||||||
return "error: [\(Twine.toolName)] File \(filename) does not exists "
|
return "error: [\(Twine.toolName)] File \(filename) does not exists "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user