Fix Color
This commit is contained in:
parent
1f2933950b
commit
3bcae91725
@ -17,8 +17,8 @@ FORCE_FLAG="$1"
|
|||||||
# --style all \
|
# --style all \
|
||||||
# --xcassets-path "./Colors/colors.xcassets" \
|
# --xcassets-path "./Colors/colors.xcassets" \
|
||||||
# --extension-output-path "./Colors/Generated/" \
|
# --extension-output-path "./Colors/Generated/" \
|
||||||
# --extension-name "UIColorYolo" \
|
# --extension-name "ColorYolo" \
|
||||||
# --extension-name-swift-ui "ColorYolo" \
|
# --extension-name-ui-kit "UIhkjhkColorYolo" \
|
||||||
# --extension-suffix "GenAllScript"
|
# --extension-suffix "GenAllScript"
|
||||||
#
|
#
|
||||||
#echo "\n-------------------------\n"
|
#echo "\n-------------------------\n"
|
||||||
@ -49,17 +49,17 @@ FORCE_FLAG="$1"
|
|||||||
# --extension-output-path "./Tags/Generated" \
|
# --extension-output-path "./Tags/Generated" \
|
||||||
# --extension-name "Tags" \
|
# --extension-name "Tags" \
|
||||||
# --extension-suffix "GenAllScript"
|
# --extension-suffix "GenAllScript"
|
||||||
#
|
|
||||||
echo "\n-------------------------\n"
|
|
||||||
|
|
||||||
# Analytics
|
#echo "\n-------------------------\n"
|
||||||
swift run -c release ResgenSwift analytics $FORCE_FLAG "./Tags/sampleTags.yml" \
|
|
||||||
--target "matomo firebase" \
|
|
||||||
--extension-output-path "./Tags/Generated" \
|
|
||||||
--extension-name "Analytics" \
|
|
||||||
--extension-suffix "GenAllScript"
|
|
||||||
|
|
||||||
echo "\n-------------------------\n"
|
## Analytics
|
||||||
|
#swift run -c release ResgenSwift analytics $FORCE_FLAG "./Tags/sampleTags.yml" \
|
||||||
|
# --target "matomo firebase" \
|
||||||
|
# --extension-output-path "./Tags/Generated" \
|
||||||
|
# --extension-name "Analytics" \
|
||||||
|
# --extension-suffix "GenAllScript"
|
||||||
|
|
||||||
|
#echo "\n-------------------------\n"
|
||||||
#
|
#
|
||||||
## Images
|
## Images
|
||||||
#swift run -c release ResgenSwift images $FORCE_FLAG "./Images/sampleImages.txt" \
|
#swift run -c release ResgenSwift images $FORCE_FLAG "./Images/sampleImages.txt" \
|
||||||
|
@ -61,8 +61,8 @@ colors:
|
|||||||
style: all
|
style: all
|
||||||
xcassetsPath: ./Colors/colors.xcassets
|
xcassetsPath: ./Colors/colors.xcassets
|
||||||
extensionOutputPath: ./Colors/Generated/
|
extensionOutputPath: ./Colors/Generated/
|
||||||
extensionName: UIColorYolo
|
extensionName: ColorYolo
|
||||||
extensionNameSwiftUI: ColorYolo
|
extensionNameUIKit: UIColorYolo
|
||||||
extensionSuffix: GenAllScript
|
extensionSuffix: GenAllScript
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@ struct Colors: ParsableCommand {
|
|||||||
// MARK: - Static
|
// MARK: - Static
|
||||||
|
|
||||||
static let toolName = "Color"
|
static let toolName = "Color"
|
||||||
static let defaultExtensionName = "UIColor"
|
static let defaultExtensionName = "Color"
|
||||||
static let defaultExtensionNameSUI = "Color"
|
static let defaultExtensionNameUIKit = "UIColor"
|
||||||
static let assetsColorsFolderName = "Colors"
|
static let assetsColorsFolderName = "Colors"
|
||||||
|
|
||||||
// MARK: - Command options
|
// MARK: - Command options
|
||||||
@ -57,14 +57,14 @@ struct Colors: ParsableCommand {
|
|||||||
staticVar: options.staticMembers,
|
staticVar: options.staticMembers,
|
||||||
extensionName: options.extensionName,
|
extensionName: options.extensionName,
|
||||||
extensionFilePath: options.extensionFilePath,
|
extensionFilePath: options.extensionFilePath,
|
||||||
isSwiftUI: false)
|
isSwiftUI: true)
|
||||||
|
|
||||||
// Generate extension
|
// Generate extension
|
||||||
ColorExtensionGenerator.writeExtensionFile(colors: parsedColors,
|
ColorExtensionGenerator.writeExtensionFile(colors: parsedColors,
|
||||||
staticVar: options.staticMembers,
|
staticVar: options.staticMembers,
|
||||||
extensionName: options.extensionNameSwiftUI,
|
extensionName: options.extensionNameUIKit,
|
||||||
extensionFilePath: options.extensionFilePathSwiftUI,
|
extensionFilePath: options.extensionFilePathUIKit,
|
||||||
isSwiftUI: true)
|
isSwiftUI: false)
|
||||||
|
|
||||||
print("[\(Self.toolName)] Colors generated")
|
print("[\(Self.toolName)] Colors generated")
|
||||||
}
|
}
|
||||||
@ -89,7 +89,7 @@ struct Colors: ParsableCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extension for UIKit and SwiftUI should have different name
|
// Extension for UIKit and SwiftUI should have different name
|
||||||
guard options.extensionName != options.extensionNameSwiftUI else {
|
guard options.extensionName != options.extensionNameUIKit else {
|
||||||
let error = ColorsToolError.extensionNamesCollision(options.extensionName)
|
let error = ColorsToolError.extensionNamesCollision(options.extensionName)
|
||||||
print(error.description)
|
print(error.description)
|
||||||
Colors.exit(withError: error)
|
Colors.exit(withError: error)
|
||||||
|
@ -27,11 +27,11 @@ struct ColorsToolOptions: ParsableArguments {
|
|||||||
@Option(help: "Tell if it will generate static properties or not")
|
@Option(help: "Tell if it will generate static properties or not")
|
||||||
var staticMembers: Bool = false
|
var staticMembers: Bool = false
|
||||||
|
|
||||||
@Option(help: "Extension name. If not specified, it will generate an UIColor extension.")
|
@Option(help: "Extension name. If not specified, it will generate an Color extension.")
|
||||||
var extensionName: String = Colors.defaultExtensionName
|
var extensionName: String = Colors.defaultExtensionName
|
||||||
|
|
||||||
@Option(help: "SwiftUI Extension name. If not specified, it will generate an Color extension.")
|
@Option(help: "SwiftUI Extension name. If not specified, it will generate an UIColor extension.")
|
||||||
var extensionNameSwiftUI: String = Colors.defaultExtensionNameSUI
|
var extensionNameUIKit: String = Colors.defaultExtensionNameUIKit
|
||||||
|
|
||||||
@Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+ColorsMyApp.swift")
|
@Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+ColorsMyApp.swift")
|
||||||
var extensionSuffix: String?
|
var extensionSuffix: String?
|
||||||
@ -41,7 +41,7 @@ struct ColorsToolOptions: ParsableArguments {
|
|||||||
|
|
||||||
extension ColorsToolOptions {
|
extension ColorsToolOptions {
|
||||||
|
|
||||||
// MARK: - UIKit
|
// MARK: - SwiftUI
|
||||||
|
|
||||||
var extensionFileName: String {
|
var extensionFileName: String {
|
||||||
if let extensionSuffix = extensionSuffix {
|
if let extensionSuffix = extensionSuffix {
|
||||||
@ -54,16 +54,16 @@ extension ColorsToolOptions {
|
|||||||
"\(extensionOutputPath)/\(extensionFileName)"
|
"\(extensionOutputPath)/\(extensionFileName)"
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - SwiftUI
|
// MARK: - UIKit
|
||||||
|
|
||||||
var extensionFileNameSwiftUI: String {
|
var extensionFileNameUIKit: String {
|
||||||
if let extensionSuffix = extensionSuffix {
|
if let extensionSuffix = extensionSuffix {
|
||||||
return "\(extensionNameSwiftUI)+\(extensionSuffix).swift"
|
return "\(extensionNameUIKit)+\(extensionSuffix).swift"
|
||||||
}
|
}
|
||||||
return "\(extensionNameSwiftUI).swift"
|
return "\(extensionNameUIKit).swift"
|
||||||
}
|
}
|
||||||
|
|
||||||
var extensionFilePathSwiftUI: String {
|
var extensionFilePathUIKit: String {
|
||||||
"\(extensionOutputPath)/\(extensionFileNameSwiftUI)"
|
"\(extensionOutputPath)/\(extensionFileNameUIKit)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
|||||||
let xcassetsPath: String
|
let xcassetsPath: String
|
||||||
let extensionOutputPath: String
|
let extensionOutputPath: String
|
||||||
let extensionName: String?
|
let extensionName: String?
|
||||||
let extensionNameSwiftUI: String?
|
let extensionNameUIKit: String?
|
||||||
let extensionSuffix: String?
|
let extensionSuffix: String?
|
||||||
private let staticMembers: Bool?
|
private let staticMembers: Bool?
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
|||||||
xcassetsPath: String,
|
xcassetsPath: String,
|
||||||
extensionOutputPath: String,
|
extensionOutputPath: String,
|
||||||
extensionName: String?,
|
extensionName: String?,
|
||||||
extensionNameSwiftUI: String?,
|
extensionNameUIKit: String?,
|
||||||
extensionSuffix: String?,
|
extensionSuffix: String?,
|
||||||
staticMembers: Bool?) {
|
staticMembers: Bool?) {
|
||||||
self.inputFile = inputFile
|
self.inputFile = inputFile
|
||||||
@ -151,7 +151,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
|||||||
self.xcassetsPath = xcassetsPath
|
self.xcassetsPath = xcassetsPath
|
||||||
self.extensionOutputPath = extensionOutputPath
|
self.extensionOutputPath = extensionOutputPath
|
||||||
self.extensionName = extensionName
|
self.extensionName = extensionName
|
||||||
self.extensionNameSwiftUI = extensionNameSwiftUI
|
self.extensionNameUIKit = extensionNameUIKit
|
||||||
self.extensionSuffix = extensionSuffix
|
self.extensionSuffix = extensionSuffix
|
||||||
self.staticMembers = staticMembers
|
self.staticMembers = staticMembers
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
|||||||
- Xcassets path: \(xcassetsPath)
|
- Xcassets path: \(xcassetsPath)
|
||||||
- Extension output path: \(extensionOutputPath)
|
- Extension output path: \(extensionOutputPath)
|
||||||
- Extension name: \(extensionName ?? "-")
|
- Extension name: \(extensionName ?? "-")
|
||||||
- Extension name SwiftUI: \(extensionNameSwiftUI ?? "-")
|
- Extension name UIKit: \(extensionNameUIKit ?? "-")
|
||||||
- Extension suffix: \(extensionSuffix ?? "-")
|
- Extension suffix: \(extensionSuffix ?? "-")
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
@ -38,10 +38,10 @@ extension ColorsConfiguration: Runnable {
|
|||||||
extensionName
|
extensionName
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
if let extensionNameSwiftUI = extensionNameSwiftUI {
|
if let extensionNameUIKit = extensionNameUIKit {
|
||||||
args += [
|
args += [
|
||||||
"--extension-name-swift-ui",
|
"--extension-name-ui-kit",
|
||||||
extensionNameSwiftUI
|
extensionNameUIKit
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
if let extensionSuffix = extensionSuffix {
|
if let extensionSuffix = extensionSuffix {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user